tracy/client
Bartosz Taudul c774534b47 Use rdtsc instead of rdtscp.
But rdtscp is serializing!

No, it's not. Quoting the Intel Instruction Set Reference:

"The RDTSCP instruction is not a serializing instruction, but it does
wait until all previous instructions have executed and all previous
loads are globally visible. But it does not wait for previous stores to
be globally visible, and subsequent instructions may begin execution
before the read operation is performed.",

"The RDTSC instruction is not a serializing instruction. It does not
necessarily wait until all previous instructions have been executed
before reading the counter. Similarly, subsequent instructions may begin
execution before the read operation is performed."

So, the difference is in waiting for prior instructions to finish
executing. Notice that even in the rdtscp case, execution of the
following instructions may commence before time measurement is finished
and data stores may be still pending.

But, you may say, Intel in its "How to Benchmark Code Execution Times"
document shows that using rdtscp is superior to rdstc. Well, not
exactly. What they do show is that when a *single function* is
considered, there are ways to measure its execution time with little to
no error.

This is not what Tracy is doing.

In our case there is no way to determine absolute "this is before" and
"this is after" points of a zone, as we probably already are inside
another zone.  Stopping the CPU execution, so that a deeply nested zone
may be measured with great precision, will skew the measurements of all
parent zones.

And this is not what we want to measure, anyway. We are not interested
in how a *single function* behaves, but how a *whole program* behaves.
The out-of-order CPU behavior may influence the measurements? Good! We
are interested in that. We want to see *how* the code is really
executed. How is *stopping* the CPU to make a timer read an appropriate
thing to do, when we want to see how a program is performing?

At least that's the theory.

And besides all that, the profiling overhead is now reduced.
2019-10-20 20:52:33 +02:00
..
tracy_concurrentqueue.h Only recycle producers, if there's no data in queue. 2019-08-30 14:28:44 +02:00
tracy_rpmalloc.cpp Clean up imported functions in multi-dll projects. 2019-06-07 19:50:08 +03:00
tracy_rpmalloc.hpp Clean up imported functions in multi-dll projects. 2019-06-07 19:50:08 +03:00
TracyArmCpuTable.hpp Display unknown implementer, part as hex values. 2019-07-03 21:18:17 +02:00
TracyCallstack.cpp Add missing NOMINMAX definitions. 2019-10-10 20:29:06 +02:00
TracyCallstack.h Callstack decode for android api <= 21. 2019-05-22 14:14:30 +02:00
TracyCallstack.hpp Callstack decode for android api <= 21. 2019-05-22 14:14:30 +02:00
TracyDxt1.cpp Fix 32 bit NEON version of DXT1 compression. 2019-09-03 21:37:07 +02:00
TracyDxt1.hpp Experimental DXT1 compressor. 2019-06-27 19:14:51 +02:00
TracyFastVector.hpp Don't mark FastVector element as used until it's ready. 2018-08-20 22:35:50 +02:00
TracyLock.hpp Extract lock state handling to a separate context class. 2019-09-21 14:55:14 +02:00
TracyProfiler.cpp Make C API symbols visible across dlls. 2019-10-03 22:39:26 +02:00
TracyProfiler.hpp Use rdtsc instead of rdtscp. 2019-10-20 20:52:33 +02:00
TracyScoped.hpp Drop support for CPU id queries. 2019-08-12 23:05:34 +02:00
TracySysTime.cpp /proc/stat might be inaccessible. 2019-04-04 15:25:26 +02:00
TracySysTime.hpp CPU usage getter for apple. 2019-02-25 15:04:06 +01:00
TracySysTrace.cpp Use proper type. 2019-10-10 20:30:08 +02:00
TracySysTrace.hpp Allow completely disabling system tracing. 2019-08-21 01:16:25 +02:00
TracySysTracePayload.hpp Embed precompiled tracy_systrace for android. 2019-09-27 15:50:58 +02:00
TracyThread.hpp Enforce proper calling convention on x86. 2017-10-30 21:46:50 +01:00