Caliper icon indicating copy to clipboard operation
Caliper copied to clipboard

how caliper measures code region runtime?

Open twang15 opened this issue 5 years ago • 2 comments

Using caliper instrumentation to measure end-to-end runtime, I am confused by the following 2 cases.

Suppose the program is instrumented as following:

main() { cali_begin_string_byname('loop', 'main') ..

cali_begin_string_byname('loop', 'loop1') loop1 code cali_end_byname('loop')

... cali_begin_string_byname('loop', 'loop2') loop1 code cali_end_byname('loop') .. cali_end_byname('loop') }

After data collection, I process the data with cali-query -s time.inclusive.duration --table a.cali

My expectation is that aggregation of caliper entry "main" should be the end-to-end runtime. But, I observe two cases:

  1. for some apps, the result is as expected. The entries are like: main main/loop1 main/loop2

  2. for others, there is no "main" entry, but only entries like main/loop1 main/loop2

I am not sure why I see the differences between case 1 and case 2. Could anyone explain this?

twang15 avatar Aug 26 '18 17:08 twang15

Are you sure the cali_end_byname() at the end of the main loop is there and being executed?

daboehme avatar Aug 27 '18 15:08 daboehme

Yes, it is executed.

Does cali_end_byname have to immediately follow a loop? For example, in the following code snippet, function foo does not have a loop. Will caliper time function foo properly?

cali_begin_by_string('foo', 'function1') call foo() cali_end_byname('foo')

twang15 avatar Aug 28 '18 20:08 twang15