Skip to contentSkip to conversation

gputop memory information

PATCH In review Rob Clark 3 participants 9 messages Apr 7, 2023 – May 22, 2023 Library code

lore
Share & tools
lore

Rob Clark

author
#0 lore raw

cover gputop memory information

From: Rob Clark <[email protected]>

This applies on top of Tvrtko's series to add a vendor agnostic gputop[1]. And uses the utilizes the memory related fdinfo props added by [2].

If anyone has a better idea how to display the memory usage, I'm all ears.. but the current thing is a tight squeeze to keep the text columns under half or 80 col. (It ended up at 41 col.)

[1] https://patchwork.freedesktop.org/series/102175/
[2] https://patchwork.freedesktop.org/series/116217/

Rob Clark (2):
lib/igt_drm_fdinfo: Parse memory usage
gputop: Add memory information

 lib/igt_drm_clients.c |  1 +
 lib/igt_drm_clients.h |  3 +++
 lib/igt_drm_fdinfo.c  | 39 +++++++++++++++++++++++++++++++++++++++
 lib/igt_drm_fdinfo.h  |  9 +++++++++
 tools/gputop.c        | 24 ++++++++++++++++++++++--
 5 files changed, 74 insertions(+), 2 deletions(-)
Signature · 1 line
2.39.2
author
#1 lore raw

PATCH 1/2 lib/igt_drm_fdinfo: Parse memory usage

From: Rob Clark <[email protected]>

Add parsing for the memory usage related fdinfo stats.

---
 lib/igt_drm_fdinfo.c | 39 +++++++++++++++++++++++++++++++++++++++
 lib/igt_drm_fdinfo.h |  9 +++++++++
 2 files changed, 48 insertions(+)
lib/igt_drm_fdinfo.c +39 -0
index b850d221..6269e166 100644
@@ -124,6 +124,34 @@ static const char *find_kv(const char *buf, const char *key, size_t keylen)
 	return *p ? p : NULL;
 }
 
+static size_t find_mem_kv(const char *buf, const char *key)
+{
+	const char *val = find_kv(buf, key, strlen(key));
+	char *p, *unit = NULL;
+	size_t sz;
+
+	if (!val)
+		return 0;
+
+	sz = atoi(val);
+
+	p = index(val, ' ');
+	if (!p)
+		return sz;
+
+	unit = ++p;
+
+	if (!strcmp(unit, "KiB")) {
+		sz *= 1024;
+	} else if (!strcmp(unit, "MiB")) {
+		sz *= 1024 * 1024;
+	} else if (!strcmp(unit, "GiB")) {
+		sz *= 1024 * 1024 * 1024;
+	}
+
+	return sz;
+}
+
 unsigned int
 __igt_parse_drm_fdinfo(int dir, const char *fd, struct drm_client_fdinfo *info,
 		       const char **name_map, unsigned int map_entries)
@@ -140,6 +168,7 @@ __igt_parse_drm_fdinfo(int dir, const char *fd, struct drm_client_fdinfo *info,
 	while ((l = strtok_r(_buf, "\n", &ctx))) {
 		uint64_t val = 0;
 		const char *v;
+		size_t sz;
 		int idx;
 
 		_buf = NULL;
@@ -173,6 +202,16 @@ __igt_parse_drm_fdinfo(int dir, const char *fd, struct drm_client_fdinfo *info,
 				info->capacity[idx] = val;
 				num_capacity++;
 			}
+		} else if ((sz = find_mem_kv(l, "drm-shared-memory"))) {
+			info->mem.shared = sz;
+		} else if ((sz = find_mem_kv(l, "drm-private-memory"))) {
+			info->mem.private = sz;
+		} else if ((sz = find_mem_kv(l, "drm-resident-memory"))) {
+			info->mem.resident = sz;
+		} else if ((sz = find_mem_kv(l, "drm-purgeable-memory"))) {
+			info->mem.purgeable = sz;
+		} else if ((sz = find_mem_kv(l, "drm-active-memory"))) {
+			info->mem.active = sz;
 		}
 	}
 
lib/igt_drm_fdinfo.h +9 -0
index 6284e05e..dd4bdd54 100644
@@ -32,6 +32,14 @@
 
 #define DRM_CLIENT_FDINFO_MAX_ENGINES 16
 
+struct drm_client_meminfo {
+	size_t shared;
+	size_t private;
+	size_t resident;
+	size_t purgeable;
+	size_t active;
+};
+
 struct drm_client_fdinfo {
 	char driver[128];
 	char pdev[128];
@@ -42,6 +50,7 @@ struct drm_client_fdinfo {
 	unsigned int capacity[DRM_CLIENT_FDINFO_MAX_ENGINES];
 	char names[DRM_CLIENT_FDINFO_MAX_ENGINES][256];
 	uint64_t busy[DRM_CLIENT_FDINFO_MAX_ENGINES];
+	struct drm_client_meminfo mem;
 };
 
 /**
Signature · 1 line
2.39.2
#2 lore raw

Re: [igt-dev] [PATCH igt 1/2] lib/igt_drm_fdinfo: Parse memory usage

Quoted 15 lines · Rob Clark

From: Rob Clark <[email protected]>

Add parsing for the memory usage related fdinfo stats.

---
  lib/igt_drm_fdinfo.c | 39 +++++++++++++++++++++++++++++++++++++++
  lib/igt_drm_fdinfo.h |  9 +++++++++
  2 files changed, 48 insertions(+)
lib/igt_drm_fdinfo.c +0 -0
index b850d221..6269e166 100644

lib/igt_drm_fdinfo.c static const char *find_kv(const char *buf, const char *key, size_t keylen) · line 129

Quoted 6 lines
lib/igt_drm_fdinfo.c +3 -0
@@ -124,6 +124,34 @@ static const char *find_kv(const char *buf, const char *key, size_t keylen)
  	return *p ? p : NULL;
  }
 
+static size_t find_mem_kv(const char *buf, const char *key)
+{
+	const char *val = find_kv(buf, key, strlen(key));

If you were asking yourself why I made strlen an argument to find_kv I have to admit I micro-optimized it a bit based on profiling. Sad fact is hunting for drm fdinfo in procfs sucks and gputop uses more CPU time than top, to even display less data. More processes with more open files there are, even when the 99.9% are not DRM, more taxing it is.

So I'd suggest sticking to the micro-optimized pattern. :(

lib/igt_drm_fdinfo.c static const char *find_kv(const char *buf, const char *key, size_t keylen) · line 136

Quoted 7 lines
lib/igt_drm_fdinfo.c +7 -0
+	char *p, *unit = NULL;
+	size_t sz;
+
+	if (!val)
+		return 0;
+
+	sz = atoi(val);

Maybe atol and unsigned long instead of size_t would be better for the counts throughout? Or uint64_t?

lib/igt_drm_fdinfo.c static const char *find_kv(const char *buf, const char *key, size_t keylen) · line 138

Quoted 2 lines
lib/igt_drm_fdinfo.c +2 -0
+
+	p = index(val, ' ');

Ok, or can use the flexible method from find_kv which skips any amount of any whitespace.

Quoted 31 lines
lib/igt_drm_fdinfo.c +17 -0
+	if (!p)
+		return sz;
+
+	unit = ++p;
+
+	if (!strcmp(unit, "KiB")) {
+		sz *= 1024;
+	} else if (!strcmp(unit, "MiB")) {
+		sz *= 1024 * 1024;
+	} else if (!strcmp(unit, "GiB")) {
+		sz *= 1024 * 1024 * 1024;
+	}
+
+	return sz;
+}
+
  unsigned int
  __igt_parse_drm_fdinfo(int dir, const char *fd, struct drm_client_fdinfo *info,
  		       const char **name_map, unsigned int map_entries)
@@ -140,6 +168,7 @@ __igt_parse_drm_fdinfo(int dir, const char *fd, struct drm_client_fdinfo *info,
  	while ((l = strtok_r(_buf, "\n", &ctx))) {
  		uint64_t val = 0;
  		const char *v;
+		size_t sz;
  		int idx;
 
  		_buf = NULL;
@@ -173,6 +202,16 @@ __igt_parse_drm_fdinfo(int dir, const char *fd, struct drm_client_fdinfo *info,
  				info->capacity[idx] = val;
  				num_capacity++;
  			}

lib/igt_drm_fdinfo.c __igt_parse_drm_fdinfo(int dir, const char *fd, struct drm_client_fdinfo *info, · line 214

Quoted 10 lines
lib/igt_drm_fdinfo.c +10 -0
+		} else if ((sz = find_mem_kv(l, "drm-shared-memory"))) {
+			info->mem.shared = sz;
+		} else if ((sz = find_mem_kv(l, "drm-private-memory"))) {
+			info->mem.private = sz;
+		} else if ((sz = find_mem_kv(l, "drm-resident-memory"))) {
+			info->mem.resident = sz;
+		} else if ((sz = find_mem_kv(l, "drm-purgeable-memory"))) {
+			info->mem.purgeable = sz;
+		} else if ((sz = find_mem_kv(l, "drm-active-memory"))) {
+			info->mem.active = sz;

Okay there's an open on key naming and if we went with drm-memory-... this could be done with just one strncmp on non-matching lines. Depends on the open.

Quoted 23 lines
lib/igt_drm_fdinfo.c +0 -0
  		}
  	}
 
lib/igt_drm_fdinfo.h +8 -0
index 6284e05e..dd4bdd54 100644
@@ -32,6 +32,14 @@
 
  #define DRM_CLIENT_FDINFO_MAX_ENGINES 16
 
+struct drm_client_meminfo {
+	size_t shared;
+	size_t private;
+	size_t resident;
+	size_t purgeable;
+	size_t active;
+};
+
  struct drm_client_fdinfo {
  	char driver[128];
  	char pdev[128];

lib/igt_drm_fdinfo.h struct drm_client_fdinfo { · line 56

Quoted 7 lines
lib/igt_drm_fdinfo.h +1 -0
@@ -42,6 +50,7 @@ struct drm_client_fdinfo {
  	unsigned int capacity[DRM_CLIENT_FDINFO_MAX_ENGINES];
  	char names[DRM_CLIENT_FDINFO_MAX_ENGINES][256];
  	uint64_t busy[DRM_CLIENT_FDINFO_MAX_ENGINES];
+	struct drm_client_meminfo mem;
  };
 
  /**

Regards,

Tvrtko

author
#3 lore raw

Re: [igt-dev] [PATCH igt 1/2] lib/igt_drm_fdinfo: Parse memory usage

Quoted 21 lines · Tvrtko Ursulin
Quoted 18 lines · Rob Clark

From: Rob Clark <[email protected]>

Add parsing for the memory usage related fdinfo stats.

---
  lib/igt_drm_fdinfo.c | 39 +++++++++++++++++++++++++++++++++++++++
  lib/igt_drm_fdinfo.h |  9 +++++++++
  2 files changed, 48 insertions(+)
lib/igt_drm_fdinfo.c +0 -0
index b850d221..6269e166 100644
@@ -124,6 +124,34 @@ static const char *find_kv(const char *buf, const char *key, size_t keylen)
      return *p ? p : NULL;
  }
 
Quoted 9 lines

lib/igt_drm_fdinfo.c static const char *find_kv(const char *buf, const char *key, size_t keylen) · line 129

Quoted 3 lines
lib/igt_drm_fdinfo.c +3 -0
+static size_t find_mem_kv(const char *buf, const char *key)
+{
+     const char *val = find_kv(buf, key, strlen(key));

If you were asking yourself why I made strlen an argument to find_kv I have to admit I micro-optimized it a bit based on profiling. Sad fact is hunting for drm fdinfo in procfs sucks and gputop uses more CPU time than top, to even display less data. More processes with more open files there are, even when the 99.9% are not DRM, more taxing it is.

Did a release build really not end up with it inlined?? If so I guess we can make this a macro, but it seems a bit surprising. This should be a thing the compiler can figure out.

BR,
-R

Quoted 99 lines

So I'd suggest sticking to the micro-optimized pattern. :(

lib/igt_drm_fdinfo.c static const char *find_kv(const char *buf, const char *key, size_t keylen) · line 136

Quoted 7 lines
lib/igt_drm_fdinfo.c +7 -0
+     char *p, *unit = NULL;
+     size_t sz;
+
+     if (!val)
+             return 0;
+
+     sz = atoi(val);

Maybe atol and unsigned long instead of size_t would be better for the counts throughout? Or uint64_t?

lib/igt_drm_fdinfo.c static const char *find_kv(const char *buf, const char *key, size_t keylen) · line 138

Quoted 2 lines
lib/igt_drm_fdinfo.c +2 -0
+
+     p = index(val, ' ');

Ok, or can use the flexible method from find_kv which skips any amount of any whitespace.

Quoted 31 lines
lib/igt_drm_fdinfo.c +17 -0
+     if (!p)
+             return sz;
+
+     unit = ++p;
+
+     if (!strcmp(unit, "KiB")) {
+             sz *= 1024;
+     } else if (!strcmp(unit, "MiB")) {
+             sz *= 1024 * 1024;
+     } else if (!strcmp(unit, "GiB")) {
+             sz *= 1024 * 1024 * 1024;
+     }
+
+     return sz;
+}
+
  unsigned int
  __igt_parse_drm_fdinfo(int dir, const char *fd, struct drm_client_fdinfo *info,
                     const char **name_map, unsigned int map_entries)
@@ -140,6 +168,7 @@ __igt_parse_drm_fdinfo(int dir, const char *fd, struct drm_client_fdinfo *info,
      while ((l = strtok_r(_buf, "\n", &ctx))) {
              uint64_t val = 0;
              const char *v;
+             size_t sz;
              int idx;
 
              _buf = NULL;
@@ -173,6 +202,16 @@ __igt_parse_drm_fdinfo(int dir, const char *fd, struct drm_client_fdinfo *info,
                              info->capacity[idx] = val;
                              num_capacity++;
                      }

lib/igt_drm_fdinfo.c __igt_parse_drm_fdinfo(int dir, const char *fd, struct drm_client_fdinfo *info, · line 214

Quoted 10 lines
lib/igt_drm_fdinfo.c +10 -0
+             } else if ((sz = find_mem_kv(l, "drm-shared-memory"))) {
+                     info->mem.shared = sz;
+             } else if ((sz = find_mem_kv(l, "drm-private-memory"))) {
+                     info->mem.private = sz;
+             } else if ((sz = find_mem_kv(l, "drm-resident-memory"))) {
+                     info->mem.resident = sz;
+             } else if ((sz = find_mem_kv(l, "drm-purgeable-memory"))) {
+                     info->mem.purgeable = sz;
+             } else if ((sz = find_mem_kv(l, "drm-active-memory"))) {
+                     info->mem.active = sz;

Okay there's an open on key naming and if we went with drm-memory-... this could be done with just one strncmp on non-matching lines. Depends on the open.

Quoted 23 lines
lib/igt_drm_fdinfo.c +0 -0
              }
      }
 
lib/igt_drm_fdinfo.h +8 -0
index 6284e05e..dd4bdd54 100644
@@ -32,6 +32,14 @@
 
  #define DRM_CLIENT_FDINFO_MAX_ENGINES 16
 
+struct drm_client_meminfo {
+     size_t shared;
+     size_t private;
+     size_t resident;
+     size_t purgeable;
+     size_t active;
+};
+
  struct drm_client_fdinfo {
      char driver[128];
      char pdev[128];

lib/igt_drm_fdinfo.h struct drm_client_fdinfo { · line 56

Quoted 7 lines
lib/igt_drm_fdinfo.h +1 -0
@@ -42,6 +50,7 @@ struct drm_client_fdinfo {
      unsigned int capacity[DRM_CLIENT_FDINFO_MAX_ENGINES];
      char names[DRM_CLIENT_FDINFO_MAX_ENGINES][256];
      uint64_t busy[DRM_CLIENT_FDINFO_MAX_ENGINES];
+     struct drm_client_meminfo mem;
  };
 
  /**

Regards,

Tvrtko

#4 lore raw

Re: [igt-dev] [PATCH igt 1/2] lib/igt_drm_fdinfo: Parse memory usage

Quoted 33 lines · Rob Clark
Quoted 21 lines · Tvrtko Ursulin
Quoted 18 lines · Rob Clark

From: Rob Clark <[email protected]>

Add parsing for the memory usage related fdinfo stats.

---
   lib/igt_drm_fdinfo.c | 39 +++++++++++++++++++++++++++++++++++++++
   lib/igt_drm_fdinfo.h |  9 +++++++++
   2 files changed, 48 insertions(+)
lib/igt_drm_fdinfo.c +0 -0
index b850d221..6269e166 100644
@@ -124,6 +124,34 @@ static const char *find_kv(const char *buf, const char *key, size_t keylen)
       return *p ? p : NULL;
   }
 
Quoted 9 lines

lib/igt_drm_fdinfo.c static const char *find_kv(const char *buf, const char *key, size_t keylen) · line 129

Quoted 3 lines
lib/igt_drm_fdinfo.c +3 -0
+static size_t find_mem_kv(const char *buf, const char *key)
+{
+     const char *val = find_kv(buf, key, strlen(key));

If you were asking yourself why I made strlen an argument to find_kv I have to admit I micro-optimized it a bit based on profiling. Sad fact is hunting for drm fdinfo in procfs sucks and gputop uses more CPU time than top, to even display less data. More processes with more open files there are, even when the 99.9% are not DRM, more taxing it is.

Quoted 3 lines

Did a release build really not end up with it inlined?? If so I guess we can make this a macro, but it seems a bit surprising. This should be a thing the compiler can figure out.

AFAIR it wasn't able to figure out to evaluate the strlen at compile time when inside find_kv. Pretty sure it was the default build (debugoptimized) but it was also more than a year ago now so I guess I'd need to repeat the experiment to be sure.

Regards,

Tvrtko

author
#5 lore raw

PATCH 2/2 gputop: Add memory information

In reply to Rob Clark

From: Rob Clark <[email protected]>

---
 lib/igt_drm_clients.c |  1 +
 lib/igt_drm_clients.h |  3 +++
 tools/gputop.c        | 24 ++++++++++++++++++++++--
 3 files changed, 26 insertions(+), 2 deletions(-)
lib/igt_drm_clients.c +1 -0
index b3eda39c..9cd5cc5d 100644
@@ -109,6 +109,7 @@ igt_drm_client_update(struct igt_drm_client *c, unsigned int pid, char *name,
 		c->last[i] = info->busy[i];
 	}
 
+	c->mem = info->mem;
 	c->samples++;
 	c->status = IGT_DRM_CLIENT_ALIVE;
 }
lib/igt_drm_clients.h +3 -0
index df8022d4..1a631d20 100644
@@ -8,6 +8,8 @@
 
 #include <stdint.h>
 
+#include "lib/igt_drm_fdinfo.h"
+
 /**
  * SECTION:igt_drm_clients
  * @short_description: Parsing driver exposed fdinfo to track DRM clients
@@ -56,6 +58,7 @@ struct igt_drm_client {
 	unsigned long last_runtime; /* Aggregate busyness on all engines since previous scan. */
 	unsigned long *val; /* Array of engine busyness data, relative to previous scan. */
 	uint64_t *last; /* Array of engine busyness data as parsed from fdinfo. */
+	struct drm_client_meminfo mem;
 };
 
 struct igt_drm_clients {
tools/gputop.c +22 -2
index d259cac1..76677e7d 100644
@@ -28,6 +28,7 @@
 
 #include "igt_drm_clients.h"
 #include "igt_drm_fdinfo.h"
+#include "drmtest.h"
 
 static const char *bars[] = { " ", "▏", "▎", "▍", "▌", "▋", "▊", "▉", "█" };
 
@@ -67,7 +68,7 @@ static int
 print_client_header(struct igt_drm_client *c, int lines, int con_w, int con_h,
 		    int *engine_w)
 {
-	const char *pidname = "    PID               NAME ";
+	const char *pidname = "    PID    MEM ACTIV              NAME ";
 	int ret, len = strlen(pidname);
 
 	if (lines++ >= con_h || len >= con_w)
@@ -118,6 +119,21 @@ newheader(const struct igt_drm_client *c, const struct igt_drm_client *pc)
 	return !pc || c->drm_minor != pc->drm_minor;
 }
 
+static void
+print_size(size_t sz)
+{
+	char units[] = {'B', 'K', 'M', 'G'};
+	unsigned u;
+
+	for (u = 0; u < ARRAY_SIZE(units) - 1; u++) {
+		if (sz < 1024)
+			break;
+		sz /= 1024;
+	}
+
+	printf("%4zd%c ", sz, units[u]);
+}
+
 static int
 print_client(struct igt_drm_client *c, struct igt_drm_client **prevc,
 	     double t, int lines, int con_w, int con_h,
@@ -138,7 +154,11 @@ print_client(struct igt_drm_client *c, struct igt_drm_client **prevc,
 
 	*prevc = c;
 
-	printf("%8u %17s ", c->pid, c->print_name);
+	printf("%8u ", c->pid);
+	print_size(c->mem.shared + c->mem.private);
+	print_size(c->mem.active);
+	printf("%17s ", c->print_name);
+
 	lines++;
 
 	for (i = 0; c->samples > 1 && i <= c->engines->max_engine_id; i++) {
Signature · 1 line
2.39.2
#6 lore raw

Re: [igt-dev] [PATCH igt 2/2] gputop: Add memory information

Quoted 55 lines · Rob Clark

From: Rob Clark <[email protected]>

---
  lib/igt_drm_clients.c |  1 +
  lib/igt_drm_clients.h |  3 +++
  tools/gputop.c        | 24 ++++++++++++++++++++++--
  3 files changed, 26 insertions(+), 2 deletions(-)
lib/igt_drm_clients.c +1 -0
index b3eda39c..9cd5cc5d 100644
@@ -109,6 +109,7 @@ igt_drm_client_update(struct igt_drm_client *c, unsigned int pid, char *name,
  		c->last[i] = info->busy[i];
  	}
 
+	c->mem = info->mem;
  	c->samples++;
  	c->status = IGT_DRM_CLIENT_ALIVE;
  }
lib/igt_drm_clients.h +3 -0
index df8022d4..1a631d20 100644
@@ -8,6 +8,8 @@
 
  #include <stdint.h>
 
+#include "lib/igt_drm_fdinfo.h"
+
  /**
   * SECTION:igt_drm_clients
   * @short_description: Parsing driver exposed fdinfo to track DRM clients
@@ -56,6 +58,7 @@ struct igt_drm_client {
  	unsigned long last_runtime; /* Aggregate busyness on all engines since previous scan. */
  	unsigned long *val; /* Array of engine busyness data, relative to previous scan. */
  	uint64_t *last; /* Array of engine busyness data as parsed from fdinfo. */
+	struct drm_client_meminfo mem;
  };
 
  struct igt_drm_clients {
tools/gputop.c +1 -0
index d259cac1..76677e7d 100644
@@ -28,6 +28,7 @@
 
  #include "igt_drm_clients.h"
  #include "igt_drm_fdinfo.h"
+#include "drmtest.h"
 
  static const char *bars[] = { " ", "▏", "▎", "▍", "▌", "▋", "▊", "▉", "█" };
 

tools/gputop.c static int · line 71

Quoted 5 lines
tools/gputop.c +1 -1
@@ -67,7 +68,7 @@ static int
  print_client_header(struct igt_drm_client *c, int lines, int con_w, int con_h,
  		    int *engine_w)
  {
-	const char *pidname = "    PID               NAME ";
+	const char *pidname = "    PID    MEM ACTIV              NAME ";

Odd information sandwich? :) I guess it ends up looking better with the current alignment. Perhaps I should swap pid and name. Or push name last like top(1).

Anyway, I am happy that you were able to plug this into my code. Means it may not be completely impenetrable.

Quoted 26 lines
tools/gputop.c +15 -0
  	int ret, len = strlen(pidname);
 
  	if (lines++ >= con_h || len >= con_w)
@@ -118,6 +119,21 @@ newheader(const struct igt_drm_client *c, const struct igt_drm_client *pc)
  	return !pc || c->drm_minor != pc->drm_minor;
  }
 
+static void
+print_size(size_t sz)
+{
+	char units[] = {'B', 'K', 'M', 'G'};
+	unsigned u;
+
+	for (u = 0; u < ARRAY_SIZE(units) - 1; u++) {
+		if (sz < 1024)
+			break;
+		sz /= 1024;
+	}
+
+	printf("%4zd%c ", sz, units[u]);
+}
+
  static int
  print_client(struct igt_drm_client *c, struct igt_drm_client **prevc,
  	     double t, int lines, int con_w, int con_h,

tools/gputop.c print_client(struct igt_drm_client *c, struct igt_drm_client **prevc, · line 159

Quoted 7 lines
tools/gputop.c +3 -1
@@ -138,7 +154,11 @@ print_client(struct igt_drm_client *c, struct igt_drm_client **prevc,
 
  	*prevc = c;
 
-	printf("%8u %17s ", c->pid, c->print_name);
+	printf("%8u ", c->pid);
+	print_size(c->mem.shared + c->mem.private);
+	print_size(c->mem.active);

Active is more interesting than resident?

tools/gputop.c print_client(struct igt_drm_client *c, struct igt_drm_client **prevc, · line 164

Quoted 5 lines
tools/gputop.c +2 -0
+	printf("%17s ", c->print_name);
+
  	lines++;
 
  	for (i = 0; c->samples > 1 && i <= c->engines->max_engine_id; i++) {

Looks fine overall.

Regards,

Tvrtko

#7 lore raw

[igt-dev] ✗ Fi.CI.BUILD: failure for gputop memory information

In reply to Rob Clark
== Series Details ==

== Series Details ==

Series: gputop memory information
URL : https://patchwork.freedesktop.org/series/116236/
State : failure

== Summary ==

Applying: lib/igt_drm_fdinfo: Parse memory usage
Using index info to reconstruct a base tree...
M lib/igt_drm_fdinfo.c
M lib/igt_drm_fdinfo.h
Falling back to patching base and 3-way merge...
Auto-merging lib/igt_drm_fdinfo.h
Auto-merging lib/igt_drm_fdinfo.c
Applying: gputop: Add memory information
Using index info to reconstruct a base tree...
A lib/igt_drm_clients.c
A lib/igt_drm_clients.h
A tools/gputop.c
Falling back to patching base and 3-way merge...
CONFLICT (modify/delete): tools/gputop.c deleted in HEAD and modified in gputop: Add memory information. Version gputop: Add memory information of tools/gputop.c left in tree. CONFLICT (modify/delete): lib/igt_drm_clients.h deleted in HEAD and modified in gputop: Add memory information. Version gputop: Add memory information of lib/igt_drm_clients.h left in tree. CONFLICT (modify/delete): lib/igt_drm_clients.c deleted in HEAD and modified in gputop: Add memory information. Version gputop: Add memory information of lib/igt_drm_clients.c left in tree. Patch failed at 0002 gputop: Add memory information
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

#8 lore raw

[igt-dev] ✗ Fi.CI.BUILD: failure for gputop memory information (rev2)

In reply to Rob Clark
== Series Details ==

== Series Details ==

Series: gputop memory information (rev2)
URL : https://patchwork.freedesktop.org/series/116236/
State : failure

== Summary ==

Applying: lib/igt_drm_fdinfo: Parse memory usage
Applying: gputop: Add memory information
Using index info to reconstruct a base tree...
M lib/igt_drm_clients.c
M lib/igt_drm_clients.h
M tools/gputop.c
Falling back to patching base and 3-way merge... Auto-merging tools/gputop.c
CONFLICT (content): Merge conflict in tools/gputop.c Auto-merging lib/igt_drm_clients.h
Auto-merging lib/igt_drm_clients.c
Patch failed at 0002 gputop: Add memory information
When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".