Caliper
Caliper copied to clipboard
how caliper measures code region runtime?
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:
-
for some apps, the result is as expected. The entries are like: main main/loop1 main/loop2
-
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?
Are you sure the cali_end_byname()
at the end of the main loop is there and being executed?
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')