제목 그대로, top에 의존하지 않고 CPU usage를 알아내는 방법이 없을까 생각하다가 질문 드립니다.
조언 부탁드릴게요 ~ ^^
Perl CPAN의 Sys::Statistics::Linux 모듈 ( http://search.cpan.org/dist/Sys-Statistics-Linux/ ) 을 참고하시면 Linux의 모든 성능치를 어떻게 구하는지 알 수 있습니다.
CPU 사용률은http://search.cpan.org/perldoc?Sys::Statistics::Linux::CpuStats 소스를 보시면 /proc/stat 값을 일정 시간간격을 두고 파싱하여 값의 차이점과 지정한 시간간격을 이용해서 구하는 걸 볼 수 있습니다.
추가참고: http://kldp.org/node/106385#comment-492127
텍스트 포맷에 대한 자세한 정보
<code>
<blockcode>
<apache>
<applescript>
<autoconf>
<awk>
<bash>
<c>
<cpp>
<css>
<diff>
<drupal5>
<drupal6>
<gdb>
<html>
<html5>
<java>
<javascript>
<ldif>
<lua>
<make>
<mysql>
<perl>
<perl6>
<php>
<pgsql>
<proftpd>
<python>
<reg>
<spec>
<ruby>
<foo>
[foo]
/proc 을 분석해서 구하면 됩니다.
Perl CPAN의 Sys::Statistics::Linux 모듈 ( http://search.cpan.org/dist/Sys-Statistics-Linux/ )
을 참고하시면 Linux의 모든 성능치를 어떻게 구하는지 알 수 있습니다.
CPU 사용률은
http://search.cpan.org/perldoc?Sys::Statistics::Linux::CpuStats
소스를 보시면 /proc/stat 값을 일정 시간간격을 두고 파싱하여
값의 차이점과 지정한 시간간격을 이용해서 구하는 걸 볼 수 있습니다.
추가참고: http://kldp.org/node/106385#comment-492127
댓글 달기