시스템 사용율 모니터링 기능 테스트 #158
@@ -97,23 +97,32 @@ public class GpuDmonReader {
|
|||||||
|
|
||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
|
|
||||||
// 헤더 라인 제거 (# 으로 시작)
|
// 디버깅 로그
|
||||||
|
log.info("RAW: [{}]", line);
|
||||||
|
|
||||||
|
// 헤더 제거
|
||||||
if (line.startsWith("#")) continue;
|
if (line.startsWith("#")) continue;
|
||||||
|
|
||||||
// 공백 기준 분리
|
line = line.trim();
|
||||||
String[] parts = line.trim().split("\\s+");
|
if (line.isEmpty()) continue;
|
||||||
|
|
||||||
// 최소 index, util 있어야 함
|
String[] parts = line.split("\\s+");
|
||||||
if (parts.length < 3) continue;
|
|
||||||
|
// GPU index 확인
|
||||||
|
if (!parts[0].matches("\\d+")) continue;
|
||||||
|
|
||||||
// GPU index (0,1,2...)
|
|
||||||
int index = Integer.parseInt(parts[0]);
|
int index = Integer.parseInt(parts[0]);
|
||||||
|
|
||||||
// GPU 사용률 (%)
|
int util = 0;
|
||||||
int util = Integer.parseInt(parts[1]);
|
try {
|
||||||
|
util = Integer.parseInt(parts[1]); // sm 값
|
||||||
|
} catch (Exception e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// 최신 값으로 덮어쓰기
|
|
||||||
gpuUtilMap.put(index, util);
|
gpuUtilMap.put(index, util);
|
||||||
|
// GPU 값 들어오는지 확인 디버깅
|
||||||
|
log.info("GPU UPDATE → index={}, util={}", index, util);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ public class SystemMonitorService {
|
|||||||
// =========================
|
// =========================
|
||||||
@Scheduled(fixedRate = 1000)
|
@Scheduled(fixedRate = 1000)
|
||||||
public void collect() {
|
public void collect() {
|
||||||
|
// 디버깅용
|
||||||
|
log.info("collect instance = {}", this);
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// =====================
|
// =====================
|
||||||
|
|||||||
Reference in New Issue
Block a user