We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#!/bin/bash printStackOfThread_new() { while IFS=" " read -a line ; do local pid=${line[0]} local threadId=${line[1]} local threadId0x=`printf %x ${threadId}` local user=${line[2]} local pcpu=${line[4]} done } printStackOfThread() { while read threadLine ; do local pid=`echo ${threadLine} | awk '{print $1}'` local threadId=`echo ${threadLine} | awk '{print $2}'` local threadId0x=`printf %x ${threadId}` local user=`echo ${threadLine} | awk '{print $3}'` local pcpu=`echo ${threadLine} | awk '{print $5}'` done } test() { ps -Leo pid,lwp,user,comm,pcpu --no-headers| { [ -z "${pid}" ] && awk '$4=="java"{print $0}'|| awk -v "pid=${pid}" '$1==pid,$4=="java"{print $0}' } | printStackOfThread } test_new() { ps -Leo pid,lwp,user,comm,pcpu --no-headers| { [ -z "${pid}" ] && awk '$4=="java"{print $0}'|| awk -v "pid=${pid}" '$1==pid,$4=="java"{print $0}' } | printStackOfThread_new } time test time test_new
快9倍
real 0m0.361s user 0m0.013s sys 0m0.040s ---- real 0m0.043s user 0m0.012s sys 0m0.015s
望采纳~
The text was updated successfully, but these errors were encountered:
Awesome!我看看! 👍
Sorry, something went wrong.
@liuyangc3 方便给一个Pull Request 吗?
这样的改进可以直接体现在代码提交中,大家也能看到你的提交。
非常感谢你的贡献~
@liuyangc3 在 PR #50 中已经实现 👍
add contribution announcement for @liuyangc3 #50 #51
68c3d12
oldratlee
No branches or pull requests
快9倍
望采纳~
The text was updated successfully, but these errors were encountered: