Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update output parsing for nvidiamon #238

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package/src/nvidiamon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,22 @@ void nvidiamon::update_stats(const std::vector<pid_t>& pids,
}

// Loop over output
unsigned int gpu_idx{}, sm{}, mem{}, fb_mem{};
unsigned int gpu_idx{}, sm{}, mem{}, fb_mem{}, ccpm{};
pid_t pid{};
std::string enc{}, dec{}, cg_type{}, cmd_name{};
std::string enc{}, dec{}, jpg{}, ofa{}, cg_type{}, cmd_name{};
std::unordered_map<unsigned int, bool>
activegpus{}; // Avoid double counting active GPUs
for (const auto& s : cmd_result.second) {
if (s[0] == '#') continue;
std::istringstream instr(s);
instr >> gpu_idx >> pid >> cg_type >> sm >> mem >> enc >> dec >> fb_mem >>
cmd_name;
instr >> gpu_idx >> pid >> cg_type >> sm >> mem >> enc >> dec >> jpg >> ofa >> fb_mem >>
ccpm >> cmd_name;
auto read_ok = !(instr.fail() || instr.bad()); // eof() is ok
if (read_ok) {
if (log_level <= spdlog::level::debug) {
std::stringstream strm;
strm << "Good read: " << gpu_idx << " " << pid << " " << cg_type << " "
<< sm << " " << mem << " " << enc << " " << dec << " " << fb_mem
<< sm << " " << mem << " " << enc << " " << dec << " " << jpg << " " << ofa << " " << fb_mem << " " << ccpm
<< " " << cmd_name << std::endl;
debug(strm.str());
}
Expand All @@ -115,7 +115,7 @@ void nvidiamon::update_stats(const std::vector<pid_t>& pids,
std::stringstream strm;
strm << "Bad read of line: " << s << std::endl;
strm << "Parsed to: " << gpu_idx << " " << pid << " " << cg_type << " "
<< sm << " " << mem << " " << enc << " " << dec << " " << fb_mem
<< sm << " " << mem << " " << enc << " " << dec << " " << jpg << " " << ofa << " " << fb_mem << " " << ccpm
<< " " << cmd_name << std::endl;

strm << "StringStream status: good()=" << instr.good();
Expand Down
Loading