Merge pull request '시스템 사용율 모니터링 기능 테스트' (#158) from feat/training_260303 into develop

Reviewed-on: #158
This commit was merged in pull request #158.
This commit is contained in:
2026-03-19 15:37:47 +09:00
2 changed files with 20 additions and 9 deletions

View File

@@ -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);
} }
} }

View File

@@ -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 {
// ===================== // =====================