#include <linux/ptrace.h>
#include <linux/version.h>
#include <uapi/linux/bpf.h>
#include "bpf_helpers.h"

struct bpf_map_def SEC("maps") my_map = {
	.type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
	.key_size = sizeof(int),
	.value_size = sizeof(u32),
	.max_entries = 32,
};

SEC("kprobe/sys_write")
int bpf_prog1(struct pt_regs *ctx)
{
	u64 count;
	u32 key = bpf_get_smp_processor_id();
	char fmt[] = "CPU-%d   %llu\n";

	count = bpf_perf_event_read(&my_map, key);
	bpf_trace_printk(fmt, sizeof(fmt), key, count);

	return 0;
}

char _license[] SEC("license") = "GPL";
u32 _version SEC("version") = LINUX_VERSION_CODE;
><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/cgit.cgi/'><img src='/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/cgit.cgi/'>index</a> : <a href='/cgit.cgi/linux/net-next.git/'>net-next.git</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='ccf7abb93af09ad0868ae9033d1ca8108bdaec82'/><select name='h' onchange='this.form.submit();'>
<option value='emaclite-cleanup'>emaclite-cleanup</option>
<option value='master' selected='selected'>master</option>
<option value='nds-private-remove'>nds-private-remove</option>
<option value='packet-loop-back'>packet-loop-back</option>
<option value='packet-rx-pump-back'>packet-rx-pump-back</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>net-next plumbings</td><td class='sub right'>Tobias Klauser</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/linux/net-next.git/'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?id=ccf7abb93af09ad0868ae9033d1ca8108bdaec82'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/sound/firewire/fireworks/fireworks.h'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/sound/firewire/fireworks/fireworks.h?id=ccf7abb93af09ad0868ae9033d1ca8108bdaec82'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/sound/firewire/fireworks/fireworks.h?id=ccf7abb93af09ad0868ae9033d1ca8108bdaec82'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/sound/firewire/fireworks/fireworks.h?id=ccf7abb93af09ad0868ae9033d1ca8108bdaec82'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/sound/firewire/fireworks/fireworks.h'>
<input type='hidden' name='id' value='ccf7abb93af09ad0868ae9033d1ca8108bdaec82'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?id=ccf7abb93af09ad0868ae9033d1ca8108bdaec82'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/sound?id=ccf7abb93af09ad0868ae9033d1ca8108bdaec82'>sound</a>/<a href='/cgit.cgi/linux/net-next.git/log/sound/firewire?id=ccf7abb93af09ad0868ae9033d1ca8108bdaec82'>firewire</a>/<a href='/cgit.cgi/linux/net-next.git/log/sound/firewire/fireworks?id=ccf7abb93af09ad0868ae9033d1ca8108bdaec82'>fireworks</a>/<a href='/cgit.cgi/linux/net-next.git/log/sound/firewire/fireworks/fireworks.h?id=ccf7abb93af09ad0868ae9033d1ca8108bdaec82'>fireworks.h</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/sound/firewire/fireworks/fireworks.h?id=ccf7abb93af09ad0868ae9033d1ca8108bdaec82&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>