Skip to content

Commit 321d6af

Browse files
authored
Merge pull request #9 from hrdkjain/improvements
Modified: processes to show GPU Memory Use in MB but removes sm, enc and dec
2 parents 15b2513 + 0acdc97 commit 321d6af

File tree

3 files changed

+16
-32
lines changed

3 files changed

+16
-32
lines changed

src/constants.h

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,22 @@
66
#define NVSM_CONF_GCOLOR "gpuColor"
77

88
#define NVSMI_CMD_GPU_COUNT "nvidia-smi --query-gpu=count --format=csv"
9-
#define NVSMI_CMD_PROCESSES "nvidia-smi pmon -c 1"
9+
#define NVSMI_CMD_PROCESSES "nvidia-smi pmon -c 1 -s m"
1010
#define NVSMI_CMD_GPU_UTILIZATION "nvidia-smi --query-gpu=utilization.gpu --format=csv"
1111
#define NVSMI_CMD_MEM_UTILIZATION "nvidia-smi --query-gpu=utilization.memory,memory.total,memory.free,memory.used --format=csv"
1212

1313
// nvidia-smi command output indices
1414
#define NVSMI_GPUIDX 0
1515
#define NVSMI_PID 1
1616
#define NVSMI_TYPE 2
17-
#define NVSMI_SM 3
18-
#define NVSMI_MEM 4
19-
#define NVSMI_ENC 5
20-
#define NVSMI_DEC 6
21-
#define NVSMI_NAME 7
17+
#define NVSMI_MEM 3
18+
#define NVSMI_NAME 4
2219

2320
// nvidia-system-monitor processes columns
2421
#define NVSM_GPUIDX 2
2522
#define NVSM_PID 3
2623
#define NVSM_TYPE 1
27-
#define NVSM_SM 4
28-
#define NVSM_MEM 5
29-
#define NVSM_ENC 6
30-
#define NVSM_DEC 7
24+
#define NVSM_MEM 4
3125
#define NVSM_NAME 0
3226

3327
#define GRAPTH_OFFSET 32

src/processes.cpp

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,14 @@
88
#include "utils.h"
99

1010
ProcessList::ProcessList(const std::string& name, const std::string& type,
11-
const std::string& gpuIdx, const std::string& pid,
12-
const std::string& sm, const std::string& mem,
13-
const std::string& enc, const std::string& dec)
11+
const std::string& gpuIdx, const std::string& pid,
12+
const std::string& mem)
1413
{
1514
this->name = name;
1615
this->type = type;
1716
this->gpuIdx = gpuIdx;
1817
this->pid = pid;
19-
this->sm = sm;
2018
this->mem = mem;
21-
this->enc = enc;
22-
this->dec = dec;
2319
}
2420

2521
void ProcessesWorker::work() {
@@ -34,10 +30,11 @@ void ProcessesWorker::work() {
3430
data = split(lines[i], " ");
3531

3632
processes.emplace_back(
37-
data[NVSMI_NAME], data[NVSMI_TYPE],
38-
data[NVSMI_GPUIDX], data[NVSMI_PID],
39-
data[NVSMI_SM], data[NVSMI_MEM],
40-
data[NVSMI_ENC], data[NVSMI_DEC]
33+
data[NVSMI_NAME],
34+
data[NVSMI_TYPE],
35+
data[NVSMI_GPUIDX],
36+
data[NVSMI_PID],
37+
data[NVSMI_MEM]
4138
);
4239
}
4340

@@ -61,14 +58,11 @@ ProcessesTableView::ProcessesTableView(QWidget *parent) : QTableView(parent) {
6158

6259
// Column titles
6360
QStringList horizontalHeader;
64-
horizontalHeader.append("Name");
61+
horizontalHeader.append("Name of Process"); // Longer header increases column width so the process names are visible
6562
horizontalHeader.append("Type (C/G)");
6663
horizontalHeader.append("GPU ID");
6764
horizontalHeader.append("Process ID");
68-
horizontalHeader.append("Compute use");
69-
horizontalHeader.append("GPU Memory Use");
70-
horizontalHeader.append("Encoding");
71-
horizontalHeader.append("Decoding");
65+
horizontalHeader.append("GPU Memory Use (MB)");
7266

7367
model->setHorizontalHeaderLabels(horizontalHeader);
7468

@@ -134,10 +128,7 @@ void ProcessesTableView::onDataUpdated() {
134128
_setItem(i, NVSM_TYPE, type);
135129
_setItem(i, NVSM_GPUIDX, gpuIdx);
136130
_setItem(i, NVSM_PID, pid);
137-
_setItem(i, NVSM_SM, sm);
138-
_setItemExt(i, NVSM_MEM, mem, " MB");
139-
_setItem(i, NVSM_ENC, enc);
140-
_setItem(i, NVSM_DEC, dec);
131+
_setItem(i, NVSM_MEM, mem);
141132
}
142133

143134
int index = worker->processesIndexByPid(selectedPid);

src/processes.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99
struct ProcessList {
1010
std::string name;
1111
std::string type; // C or G
12-
std::string gpuIdx, pid, sm, mem, enc, dec; // integers
12+
std::string gpuIdx, pid, mem; // integers
1313

1414
ProcessList(const std::string &name, const std::string &type,
1515
const std::string &gpuIdx, const std::string &pid,
16-
const std::string &sm, const std::string &mem,
17-
const std::string &enc, const std::string &dec);
16+
const std::string &mem);
1817
};
1918

2019
class ProcessesWorker : public Worker {

0 commit comments

Comments
 (0)