int do_count()

in src/samplers/cpu/perf.c [34:94]


int do_count(struct bpf_perf_event_data *ctx) {
    u32 cpu = bpf_get_smp_processor_id();
    u64 count = 0;

    count = branch_instructions_array.perf_read(CUR_CPU_IDENTIFIER);
    if ((s64)count < -256 || (s64)count > 0) {
        branch_instructions.update(&cpu, &count);
    }

    count = branch_misses_array.perf_read(CUR_CPU_IDENTIFIER);
    if ((s64)count < -256 || (s64)count > 0) {
        branch_misses.update(&cpu, &count);
    }

    count = cache_misses_array.perf_read(CUR_CPU_IDENTIFIER);
    if ((s64)count < -256 || (s64)count > 0) {
        cache_misses.update(&cpu, &count);
    }

    count = cache_references_array.perf_read(CUR_CPU_IDENTIFIER);
    if ((s64)count < -256 || (s64)count > 0) {
        cache_references.update(&cpu, &count);
    }

    count = cycles_array.perf_read(CUR_CPU_IDENTIFIER);
    if ((s64)count < -256 || (s64)count > 0) {
        cycles.update(&cpu, &count);
    }

    count = dtlb_load_access_array.perf_read(CUR_CPU_IDENTIFIER);
    if ((s64)count < -256 || (s64)count > 0) {
        dtlb_load_access.update(&cpu, &count);
    }

    count = dtlb_load_miss_array.perf_read(CUR_CPU_IDENTIFIER);
    if ((s64)count < -256 || (s64)count > 0) {
        dtlb_load_miss.update(&cpu, &count);
    }

    count = dtlb_store_access_array.perf_read(CUR_CPU_IDENTIFIER);
    if ((s64)count < -256 || (s64)count > 0) {
        dtlb_store_access.update(&cpu, &count);
    }    

    count = dtlb_store_miss_array.perf_read(CUR_CPU_IDENTIFIER);
    if ((s64)count < -256 || (s64)count > 0) {
        dtlb_store_miss.update(&cpu, &count);
    }

    count = instructions_array.perf_read(CUR_CPU_IDENTIFIER);
    if ((s64)count < -256 || (s64)count > 0) {
        instructions.update(&cpu, &count);
    }

    count = reference_cycles_array.perf_read(CUR_CPU_IDENTIFIER);
    if ((s64)count < -256 || (s64)count > 0) {
        reference_cycles.update(&cpu, &count);
    }

    return 0;
}