Print current time in output window using TracePoint

I mainly work with C #, and I often use TracePoints (breakpoints with the setting "When hit ..."), printing the current time using {DateTime.Now.ToString(HH:mm:ss.fff")} . I know that this is not very accurate (and I know the Stopwatch class), but it is often useful for a brief overview of what happens when. In addition, it is quite easy to create this output, and it does not require compilation.

Now I am increasingly working with (native) C ++ code, and I would like to get the same result. However, it is not possible to use C # code in TracePoints in C ++ code files. Therefore, I am looking for an equivalent single-line layer in C ++ that can be used in TracePoints. Or is there another way to display current time using TracePoints?

BTW: the time output should at least have accuracy in milliseconds!

+7
c ++ time visual-studio visual-studio-2012
source share
1 answer

I just found out that you can also use the $TICK keyword in the "When hit" dialog box. You must put it in braces: {$TICK} otherwise the output will be in hexadecimal.

According to MSDN :

$ TICK inserts the current number of processor ticks

This does not give you the current time, but it can certainly be converted. In addition, ticks may already be enough for quick comparisons.

+9
source share

All Articles