시스템 사용율 모니터링 기능 테스트 #158

Merged
teddy merged 1 commits from feat/training_260303 into develop 2026-03-19 15:37:47 +09:00
2 changed files with 20 additions and 9 deletions
Showing only changes of commit 9f428e9572 - Show all commits

View File

@@ -97,23 +97,32 @@ public class GpuDmonReader {
while ((line = br.readLine()) != null) {
// 헤더 라인 제거 (# 으로 시작)
// 디버깅 로그
log.info("RAW: [{}]", line);
// 헤더 제거
if (line.startsWith("#")) continue;
// 공백 기준 분리
String[] parts = line.trim().split("\\s+");
line = line.trim();
if (line.isEmpty()) continue;
// 최소 index, util 있어야 함
if (parts.length < 3) continue;
String[] parts = line.split("\\s+");
// GPU index 확인
if (!parts[0].matches("\\d+")) continue;
// GPU index (0,1,2...)
int index = Integer.parseInt(parts[0]);
// GPU 사용률 (%)
int util = Integer.parseInt(parts[1]);
int util = 0;
try {
util = Integer.parseInt(parts[1]); // sm 값
} catch (Exception e) {
continue;
}
// 최신 값으로 덮어쓰기
gpuUtilMap.put(index, util);
// GPU 값 들어오는지 확인 디버깅
log.info("GPU UPDATE → index={}, util={}", index, util);
}
}

View File

@@ -47,6 +47,8 @@ public class SystemMonitorService {
// =========================
@Scheduled(fixedRate = 1000)
public void collect() {
// 디버깅용
log.info("collect instance = {}", this);
try {
// =====================