gpt4 book ai didi

java - strace Java 小程序

转载 作者:太空宇宙 更新时间:2023-11-04 08:59:30 25 4
gpt4 key购买 nike

我正在尝试 strace java 小程序,但 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 还很陌生。关于发生什么事的任何线索?小程序可以追踪吗?

最佳答案

您可能只跟踪单个线程。使用 -f 标志运行 strace。

关于java - strace Java 小程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1188075/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com