Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 폴-안티 스파이앱
- svn
- 라곰
- Lambda Expressions
- 정통춘천닭갈비
- windows vista
- Subversion
- 라곰프레임워크
- 윈도우즈 비스타
- 썬
- 폴안티 스파이앱
- 차이점
- lagom
- 폴안티스파이앱
- 스파이앱
- 한강 #야경 #한강야경
- 폴안티
- selenium #scraping #webscraping #jsoup #firefox
- TortoiseSVN
- lagom framework
- 스포티지r 풀체인지
- 모니터
- CVS
- volatile
- 설치
- 책상
- java8 람다식
- 폴-안티스파이앱
- 명주
- 폴-안티
Archives
- Today
- Total
장발의 개발러
Machine 의 CPU 정보 얻어 오기 본문
이걸 응용하면 Java로 시스템 모니터링이 가능해짐!
public static void main(String[] args) {
try {
// Windows 의 경우
// typeperf "\Processor(_Total)\% Processor Time" -sc 10
// -si: 간격, -sc: 수행회수
String cmd = "typeperf \"\\Processor(_Total)\\% Processor Time\" -si 5 -sc 10";
Runtime operator = Runtime.getRuntime();
Process process = operator.exec(cmd);
BufferedReader br = new BufferedReader(new InputStreamReader(
process.getInputStream(), "EUC-KR"));
String temp = br.readLine();
while ((temp = br.readLine()) != null) {
System.out.println(temp);
}
System.out.println("process.waitFor(): " + process.waitFor());
System.out.println("End");
} catch (IOException ioe) {
ioe.printStackTrace();
} catch (InterruptedException ite) {
ite.printStackTrace();
}
}