我正在尝试执行一个java applet,但strace似乎不起作用。我正在调用下面的函数。
public static void testSTrace(){
long c = 0;
for (int i = 0; i < 1000; i++){
long start = System.nanoTime();
try{Thread.sleep(0, 100);}catch(Exception e){/*cry*/}
long stop = System.nanoTime();
log.info("start : " +start+" stop : "+stop);
}
}
就在上面的消息被调用之前,我从strace得到了以下输出,然后从strace没有得到任何输出:
clone(child_stack=0xb7c9f4c4,
flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|
CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|CLONE_DETACHED,
parent_tidptr=0xb7c9fbf8, {entry_number:6, base_addr:0xb7c9fbb0,
limit:1048575, seg_32bit:1,
contents:0, read_exec_only:0,
limit_in_pages:1, seg_not_present:0, useable:1}, child_tidptr=0xb7c9fbf8) = 8351 futex(0xb7c9fbf8, FUTEX_WAIT, 8351, NULL
一旦我开始从该方法获得日志输出,我就不能再从strace获得更多信息。我对strace是个新手。有什么线索是怎么回事吗?小应用程序能被层次化吗?
发布于 2009-07-27 13:12:14
你可能只是一条线而已。使用-f标志运行strace。
发布于 2009-07-27 13:11:26
为手册页欢呼三声,我想要下面的forks标志,-f和-F
-f -- follow forks, -ff -- with output into separate files
-F -- attempt to follow vforks, -h -- print help message
strace -fF /bin/appletviewer test.html
现在我明白了:
[pid 8401] gettimeofday({1248700317, 550296}, NULL) = 0
[pid 8401] gettimeofday({1248700317, 550401}, NULL) = 0
[pid 8401] gettimeofday({1248700317, 550500}, NULL) = 0
[pid 8401] gettimeofday({1248700317, 550626}, NULL) = 0
[pid 8401] gettimeofday({1248700317, 550883}, NULL) = 0
[pid 8401] gettimeofday({1248700317, 550993}, NULL) = 0
[pid 8401] gettimeofday({1248700317, 551093}, NULL) = 0
https://stackoverflow.com/questions/1188075
复制相似问题