用一个例子来展示trace()
,print()
和printf()
的区别:
# dtrace -qn 'BEGIN{ trace(walltimestamp); exit(0) }'
1670295094532869758
# dtrace -qn 'BEGIN{ print(walltimestamp); exit(0) }'
int64_t 0x172e148c77c367d3
# dtrace -qn 'BEGIN{ printf(walltimestamp); exit(0)}'
dtrace: invalid probe specifier BEGIN{ printf(walltimestamp); exit(0)}: printf( ) argument #1 is incompatible with prototype:
prototype: string constant
argument: int64_t
# dtrace -qn 'BEGIN{ printf("%d\n", walltimestamp); exit(0)}'
1670295157720493229