Redian新闻
>
how to count the times a function is called
avatar
how to count the times a function is called# Unix - 噫吁兮,危乎高哉
h*o
1
I have a file which records the activities of all functions.
I want to count from this file how many times each of the function is called.
How to write a unix shell to count them?
or
is there any other way?
Thanks
avatar
c*j
2
don't know your file format, assume:
KEYWORD_TO_KNOW_A_FUNCTION_CALL func_name foo ...
other logs
...
awk '/KEYWORD_TO_KNOW_A_FUNCTION_CALL/ {cnt[$2]} END{for (f in cnt) print
f,
cnt[f]}'

called.

【在 h**o 的大作中提到】
: I have a file which records the activities of all functions.
: I want to count from this file how many times each of the function is called.
: How to write a unix shell to count them?
: or
: is there any other way?
: Thanks

avatar
h*o
3
I have a file which records the activities of all functions.
I want to count from this file how many times each of the function is called.
How to write a unix shell to count them?
or
is there any other way?
Thanks
avatar
c*j
4
don't know your file format, assume:
KEYWORD_TO_KNOW_A_FUNCTION_CALL func_name foo ...
other logs
...
awk '/KEYWORD_TO_KNOW_A_FUNCTION_CALL/ {cnt[$2]} END{for (f in cnt) print
f,
cnt[f]}'

called.

【在 h**o 的大作中提到】
: I have a file which records the activities of all functions.
: I want to count from this file how many times each of the function is called.
: How to write a unix shell to count them?
: or
: is there any other way?
: Thanks

avatar
s*0
5
cat yourfile | grep yourFunctionName | wc -l

called.

【在 h**o 的大作中提到】
: I have a file which records the activities of all functions.
: I want to count from this file how many times each of the function is called.
: How to write a unix shell to count them?
: or
: is there any other way?
: Thanks

avatar
T*l
6


【在 s******0 的大作中提到】
: cat yourfile | grep yourFunctionName | wc -l
:
: called.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。