On 7/22/15 1:09 AM, Kaixu Xia wrote:
+SEC("kprobe/sys_write")
+int bpf_prog1(struct pt_regs *ctx)
+{
+       u64 count;
+       u32 key = bpf_get_smp_processor_id();
+       char fmt[] = "bpf count: CPU-%d  %llu\n";
+
+       count = bpf_perf_event_read(&my_map, &key);
+       bpf_trace_printk(fmt, sizeof(fmt), key, count);
+
+       return 0;
+}

overall the whole thing looks much better, but since you can print
anything, print some sensible string here instead of 'bpf count'.

Thanks!

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to