-
Notifications
You must be signed in to change notification settings - Fork 0
[English] METRIC_START
Luiz Felipe edited this page Apr 8, 2020
·
1 revision
METRIC_START();
METRIC_STOP(name);
The macro METRIC_START
start a new block of code to measure the performance. The METRIC_STOP
mark the end of the block matching with the METRIC_START
, and print the information about the measurement.
The name
should be a literal string, and it is displayed like an identification to the block.
You can make nested blocks of measurement.
#include <stdio.h>
#include "metric.h"
int main(void)
{
volatile int x = 12345;
METRIC_START();
for (int i = 0; i < 999999; i++)
x ^= i;
METRIC_STOP("xor_x_variable");
printf("-- %d\n", x);
return 0;
}
Output:
<BENCH> tst.c: xor_x_variable
5907 clocks, 0.00590500 secs
-- 1012230