|
TimeTrac Event Examples |
This example uses multiple threads with multiple events to simulate a small application. There is no I/O involved here and no extra hardware needed for this example; the vinput generates an input internally. This example covers the following basic TimeTrac functions:
TimeTrac Output - Multiple Events with Multiple Threads |
Return to Top | ||
If we run this example, it will create a file named 00_Main.trc and several files named *_Compute.trc (each thread creates ts own file). If we then run TimeTrac in this directory, we will see a display similar to the that below. In ths case we have multiple threads each with multiple events instrumented. Each of the "compute" threads run the same code and should produce similar results for 25 iterations. |
|||
|
|||
At first glance, it appears that the processing is not uniform. We will use the time bars to expand a region for closer examination. |
TimeTrac Output -- Interrupted Operations, Linux Scheduling |
Return to Top | ||
Looking at the region around 0.2 seconds, we have several threads that have been interrupted. We can visually see that some certain instances of some functions take much longer than usual. In the first case (below), one of the threads has been interrupted by the Linux scheduler in the midst of one of its operations (thread for rank #3, the "vinput" function is taking much longer than expected), and its processor was given to another thread, most likely that of rank #1 or #2. In this example, no harm has been done; these threads are free running with no dependencies between threads. In a time critical application however, this might not be the case and the unexpected switching of threads might be important. |
|||
|
TimeTrac Outout -- Unfair Startup |
Return to Top | ||
Here we are looking at the startup sequence of the 4 threads. Even though they are directed to start at very nearly the same time and in order starting with number 1, thread with rank #4 started first and got an unfair portion of the processing power. |
|||
In this example, startup sequence does not matter but it is not what we expected. In another application, this could cause a failure before we even get started. Debugging this without TimeTrac is very painful; the use of printf's in the code could change the application's timing and printf's do not always occur in the order that they appear on the screen. Using TimeTrac is a much better method of finding these issues. |
Source Code |
Return to Top |
Module | TimeTrac Functions |
---|---|
th_main.c | All calls -- TimeTrac User Guide |
th_compute.c | All calls -- TimeTrac User Guide |
ex_alloc.c | No TimeTrac calls |
ex_math.c | No TimeTrac calls |
ex_misc.c | No TimeTrac calls |
sky_ex_inc.h | See time_trac.h |
th_tcb.h | No TimeTrac calls |
Threads Summary |
Return to Top | ||
This example shows TimeTrac outputs for an application using multiple threads with multiple operations.
|
Previous | Return Intro |
|
Return to Top | Next |