<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><hr id="zwchr"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div class="__aliyun_email_body_block"><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">Hi,Mathieu</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><br></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">> <span style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 26px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: 'times new roman', 'new york', times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 26px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;">Is your sched_getcpu() system call a vdso too</span></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><br></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"> I use VSYSCALL_ADDR(__NR_vgetcpu) instead sched_getcpu so there is no getcpu system calls.</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><br></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">> <span style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 26px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: 'times new roman', 'new york', times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 26px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;">make sure you #define _LGPL_SOURCE in your benchmark program</span></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><br></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"> I do it as you suggested but no difference.</div><div class="__aliyun_signature_wrap"><br></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><br></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">> <span style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 26px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: 'times new roman', 'new york', times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 26px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;">Then, you can try using "perf" to profile the runtime execution<span class="Apple-converted-space"> </span></span></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><span style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 26px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: 'times new roman', 'new york', times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 26px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;"><span class="Apple-converted-space"><br></span></span></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">$~/renzhyu/perf record ./sample<br>WARNING: Kernel address maps (/proc/{kallsyms,modules}) are restricted,<br>check /proc/sys/kernel/kptr_restrict.<br><div><br></div>Samples in kernel functions may not be resolved if a suitable vmlinux<br>file is not found in the buildid cache or in the vmlinux path.<br><div><br></div>Samples in kernel modules won't be resolved at all.<br><div><br></div>If some relocation was applied (e.g. kexec) symbols may be misresolved<br>even with a suitable vmlinux or kallsyms file.<br><div><br></div><br>using 5720094251 ns<br>[ perf record: Woken up 1 times to write data ]<br>[ perf record: Captured and wrote 0.221 MB perf.data (~9658 samples) ]<br></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><br></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><br></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">$~/renzhyu/perf report<br></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">Events: 5K cycles<br></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">16.82% sample liblttng-ust.so.0.0.0 [.] lttng_event_commit</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">10.55% sample liblttng-ust.so.0.0.0 [.] lttng_event_strcpy</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">10.45% sample [kernel.kallsyms] [k] 0xffffffff8103548a</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">8.16% sample liblttng-ust.so.0.0.0 [.] lttng_event_reserve</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">7.57% sample sample [.] __event_get_size__sample_component___message</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">6.42% sample sample [.] __event_probe__sample_component___message</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">6.24% sample liblttng-ust.so.0.0.0 [.] lttng_write_event_header</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">5.40% sample sample [.] _rcu_read_lock_update</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">5.35% sample sample [.] _rcu_read_unlock_bp</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">5.17% sample liburcu-bp.so.2.0.0 [.] rcu_read_unlock_bp</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">4.14% sample ld-2.5.so [.] __tls_get_addr</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">3.38% sample [vdso] [.] 0x7fff8f72e6be</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">3.35% sample sample [.] main</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">1.88% sample sample [.] lib_ring_buffer_ctx_init</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">1.79% sample sample [.] _rcu_read_lock_bp</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">1.20% sample liburcu-bp.so.2.0.0 [.] rcu_read_lock_bp</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">0.66% sample sample [.] lib_ring_buffer_align_ctx</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">0.38% sample sample [.] cds_list_empty</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">0.37% sample sample [.] lib_ring_buffer_align</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">0.35% sample liburcu-bp.so.2.0.0 [.] __tls_get_addr@plt</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">0.28% sample sample [.] __event_get_align__sample_component___message</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">0.09% sample ld-2.5.so [.] do_lookup_</div></div></blockquote><div>Did you compile your program and the probe provider<br></div><div>(tp.c) with -O2 ?<br></div><div><br></div><div>Did you define _LGPL_SOURCE at the top of both files ?<br></div><div>(the code and the probe provider)<br></div><div><br></div><div>I tried your sample.c program here:<br></div><div><br></div><div>CPU:<br></div><div>Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz</div><div>This is within a virtual machine.<br></div><div><br></div><div>And I get 302 ns/event (total: 3019987815ns exec time)<br></div><div><br></div><div>I see that in the numbers you provided in your earlier email,<br></div><div>you talk about "us" (microseconds), did you actually mean</div><div>"ns" (nanoseconds) ?<br></div><div><br></div><div>I enabled tracing this way:<br></div><div><br></div><div>lttng create --snapshot<br></div><div>lttng enable-event -u -a<br></div><div>lttng start<br></div><div><br></div><div>Thoughts ?<br></div><div><br></div><div>Thanks,<br></div><div><br></div><div>Mathieu<br></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div class="__aliyun_email_body_block"><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">The symbol <span style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;">0xffffffff8103548a is in native_write_msr_safe,I don't know what the function is and why that kernel function can be TOP 3.</span></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><span style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;">ffffffff81035480 <native_write_msr_safe>:<br>ffffffff81035480: 55 push %rbp<br>ffffffff81035481: 89 f9 mov %edi,%ecx<br>ffffffff81035483: 89 f0 mov %esi,%eax<br>ffffffff81035485: 48 89 e5 mov %rsp,%rbp<br>ffffffff81035488: 0f 30 wrmsr<br>ffffffff8103548a: 31 c0 xor %eax,%eax<br>ffffffff8103548c: c9 leaveq<br>ffffffff8103548d: c3 retq<br>ffffffff8103548e: 66 90 xchg %ax,%ax</span></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><span style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;"><br></span></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><span style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;">PS:my sample.c</span></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><span style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;"><br></span></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><span style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;">#include <time.h><br>#include <unistd.h><br>#include <stdio.h><br></span></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><span style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;"><span style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;">#define _LGPL_SOURCE<br>#define TRACEPOINT_DEFINE<br>#include "sample_component_provider.h"<br></span></span><div><br></div><span style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;">#define NUM 10000000<br></span></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><span style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;">int main(int argc, char **argv)<br>{<br> int i = 0;<br> struct timespec bef,aft;<br> long diff;<br> clock_gettime(CLOCK_MONOTONIC,&bef);<br> for (i = 0; i < NUM; i++) {<br>tracepoint(sample_component, message, "HelloWorld");<br> }<br> clock_gettime(CLOCK_MONOTONIC,&aft);<br> diff = (aft.tv_sec-bef.tv_sec)*1000000000+(aft.tv_nsec-bef.tv_nsec);<br> printf("using %ld ns\n", diff);<br></span></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><span style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;"> return 0;<br>}<br></span></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><span style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;"><br></span></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><span style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;">Thanks</span></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000;" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><span style="color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;" data-mce-style="color: #000000; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;">zhenyu.ren</span></div><blockquote style="margin-right:0;margin-top:0;margin-bottom:0" data-mce-style="margin-right: 0; margin-top: 0; margin-bottom: 0;"><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">------------------------------------------------------------------</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">发件人:Mathieu Desnoyers <mathieu.desnoyers@efficios.com></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">发送时间:2015年4月28日(星期二) 23:47</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">收件人:zhenyu.ren <zhenyu.ren@aliyun.com></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">抄 送:lttng-dev <lttng-dev@lists.lttng.org></div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;">主 题:Re: [lttng-dev] UST performance</div><div style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:#000000" data-mce-style="font-family: Tahoma,Arial,STHeiti,SimSun; font-size: 14px; color: #000000;"><br></div><div style="font-family: times new roman , new york , times , serif;font-size: 12.0pt;color: #000000;" data-mce-style="font-family: times new roman , new york , times , serif; font-size: 12.0pt; color: #000000;"><div>Hi,</div><div><br></div><div>Is your sched_getcpu() system call a vdso too ? This may explain the difference.<br></div><div><br></div><div>Moreover, make sure you #define _LGPL_SOURCE in your benchmark program<br></div><div>before including any lttng ust header. It will inline many functions associated with<br></div><div>tracepoints.<br></div><div><br></div><div>Then, you can try using "perf" to profile the runtime execution of your program<br></div><div>traced by lttng-ust ? This should give us the information we need to investigate the<br></div><div>performance profile.<br></div><div><br></div><div>Thanks,<br></div><div><br></div><div>Mathieu<br></div><div><br></div><div><br></div><hr id="zwchr"><blockquote style="border-left: 2.0px solid #1010ff;margin-left: 5.0px;padding-left: 5.0px;color: #000000;font-weight: normal;font-style: normal;text-decoration: none;font-family: Helvetica , Arial , sans-serif;font-size: 12.0pt;" data-mce-style="border-left: 2.0px solid #1010ff; margin-left: 5.0px; padding-left: 5.0px; color: #000000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica , Arial , sans-serif; font-size: 12.0pt;"><div class="__aliyun_email_body_block"><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;">Hi,dev</div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;"><br></div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;"> About a month ago,I asked a question about how to do time recording for ust event when vdso_clock_gettime not availble on my platform(Glibc too old).Recently I implemented a lib to analyze vdso in memory and lookuped the symbol vdso_clock_gettime successfully.With this vdso_clock_gettime availble,I get a 16% improvement in time spending per ust event. I.E. I measured the time taked by a event with 10 bytes string :</div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;"><br></div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;"> no vdso_clock_gettime : 0.642us</div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;"> with vdso_clock_gettime:0.554us</div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;"><br></div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;">However,Both the numbers are much higher than the following 0.28us(But closed to 0.5us --W/O opt). So what's the difference between UST(0.28us) and UST W/O OPT(0.5us)?? </div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;"><br></div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;"><br></div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;"><br></div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;"><br></div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;">PS:My hardware</div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;">2 x Xeon E5-2430 2.20GHz 100MHz FSB (24 cores) 94.6GB / 96GB 1333MHz DDR3 == 6 x 16GB, 6 x empty</div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;"><br></div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;">Thanks</div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;">zhenyu.ren</div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;"><br></div><div class="__aliyun_signature_wrap"><br></div><div style="font-family: Tahoma , Arial , STHeiti , SimSun;font-size: 14.0px;color: #000000;" data-mce-style="font-family: Tahoma , Arial , STHeiti , SimSun; font-size: 14.0px; color: #000000;"><br></div></div><br>_______________________________________________<br>lttng-dev mailing list<br>lttng-dev@lists.lttng.org<br><a href="http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev" target="_blank" data-mce-href="http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev">http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev</a><br></blockquote><div><br><div><br></div></div><div><br></div><div>-- <br></div><div>Mathieu Desnoyers<br>EfficiOS Inc.<br><a href="http://www.efficios.com" target="_blank" data-mce-href="http://www.efficios.com">http://www.efficios.com</a><br></div></div></blockquote></div></blockquote><div><br><br></div><div><br></div><div>-- <br></div><div><span name="x"></span>Mathieu Desnoyers<br>EfficiOS Inc.<br>http://www.efficios.com<span name="x"></span><br></div></div></body></html>