summaryrefslogtreecommitdiff
path: root/targets/kernel_usdt_tick.c
blob: 29a7ed8ea3c9379319e9582dc981d33460bf28f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// The probe of kernel_usdt.c that has a semaphore: a file is all with or
// all without.
#define _SDT_HAS_SEMAPHORES 1
#include <sys/sdt.h>

unsigned short ztrace_tick_semaphore __attribute__((section(".probes")));

long work(long n) {
    long sum = 0;
    for (long i = 0; i < n; i++) {
        sum += i * i;
        if (ztrace_tick_semaphore) DTRACE_PROBE2(ztrace, tick, i, sum);
    }
    return sum;
}