-
Nikita V. Shirokov authored
* [profile.py]: adding support to collect profile only from specified CPU Summary: sometime it is usefull to collect stack only from single cpu for example you have single core saturated while others dont and you want to know whats going on there. in this diff i'm adding this ability (network related code could be example of when single core is saturated as usually you have 1 to 1 mappng between rx queue and cpu) example of generated code w/ CPU specified: ./tools/profile.py -C 14 2 --ebpf Sampling at 49 Hertz of all threads by user + kernel stack for 2 secs. struct key_t { u32 pid; u64 kernel_ip; u64 kernel_ret_ip; int user_stack_id; int kernel_stack_id; char name[TASK_COMM_LEN]; }; BPF_HASH(counts, struct key_t); BPF_STACK_TRACE(stack_traces, 16384); // This code gets a bit complex. Probably not suitable for casual hacking. int do_perf_event(struct bpf_perf_event_data *ctx) { if (bpf_get_smp_processor_id() != 14) return 0; u32 pid = bpf_get_current_pid_tgid() >> 32; ... and w/o ./tools/profile.py 2 --ebpf Sampling at 49 Hertz of all threads by user + kernel stack for 2 secs. struct key_t { u32 pid; u64 kernel_ip; u64 kernel_ret_ip; int user_stack_id; int kernel_stack_id; char name[TASK_COMM_LEN]; }; BPF_HASH(counts, struct key_t); BPF_STACK_TRACE(stack_traces, 16384); // This code gets a bit complex. Probably not suitable for casual hacking. int do_perf_event(struct bpf_perf_event_data *ctx) { u32 pid = bpf_get_current_pid_tgid() >> 32; if (!(1)) return 0; ... * addressing comments * adding change in man
e36f9e16