[Intel-gfx] [PATCH igt] Put thousands separators in %llu outputs

Michel Thierry michel.thierry at intel.com
Wed Jun 24 06:40:13 PDT 2015


After Chris' "Enable locale dependent output to a terminal" patch,
we can put thousand separators into these long long outputs.

sed "s/%ll/%'ll/g"

Signed-off-by: Michel Thierry <michel.thierry at intel.com>
---
 lib/intel_os.c        | 4 ++--
 overlay/cpu-top.c     | 2 +-
 overlay/overlay.c     | 4 ++--
 tests/gem_exec_big.c  | 4 ++--
 tools/intel_gpu_top.c | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/intel_os.c b/lib/intel_os.c
index 3321a8d..f82847f 100644
--- a/lib/intel_os.c
+++ b/lib/intel_os.c
@@ -225,7 +225,7 @@ void intel_require_memory(uint32_t count, uint32_t size, unsigned mode)
 	required *= size + KERNEL_BO_OVERHEAD;
 	required = ALIGN(required, 4096);
 
-	igt_debug("Checking %u surfaces of size %u bytes (total %llu) against %s%s\n",
+	igt_debug("Checking %u surfaces of size %u bytes (total %'llu) against %s%s\n",
 		  count, size, (long long)required,
 		  mode & (CHECK_RAM | CHECK_SWAP) ? "RAM" : "",
 		  mode & CHECK_SWAP ? " + swap": "");
@@ -238,7 +238,7 @@ void intel_require_memory(uint32_t count, uint32_t size, unsigned mode)
 	total *= 1024 * 1024;
 
 	igt_skip_on_f(total <= required,
-		      "Estimated that we need %llu bytes for the test, but only have %llu bytes available (%s%s)\n",
+		      "Estimated that we need %'llu bytes for the test, but only have %'llu bytes available (%s%s)\n",
 		      (long long)required, (long long)total,
 		      mode & (CHECK_RAM | CHECK_SWAP) ? "RAM" : "",
 		      mode & CHECK_SWAP ? " + swap": "");
diff --git a/overlay/cpu-top.c b/overlay/cpu-top.c
index 13ae70d..acc85af 100644
--- a/overlay/cpu-top.c
+++ b/overlay/cpu-top.c
@@ -63,7 +63,7 @@ int cpu_top_update(struct cpu_top *cpu)
 	sscanf(buf, "cpu %lu %lu %lu %lu",
 	       &s->user, &s->nice, &s->sys, &s->idle);
 #else
-	sscanf(buf, "cpu %llu %llu %llu %llu",
+	sscanf(buf, "cpu %'llu %'llu %'llu %'llu",
 	       &s->user, &s->nice, &s->sys, &s->idle);
 #endif
 
diff --git a/overlay/overlay.c b/overlay/overlay.c
index 7759c2b..d146149 100644
--- a/overlay/overlay.c
+++ b/overlay/overlay.c
@@ -697,7 +697,7 @@ static void show_gpu_freq(struct overlay_context *ctx, struct overlay_gpu_freq *
 	}
 
 	if (has_power) {
-		sprintf(buf, "Power: %llumW", (long long unsigned)gf->power.power_mW);
+		sprintf(buf, "Power: %'llumW", (long long unsigned)gf->power.power_mW);
 		cairo_set_source_rgba(ctx->cr, 1, 1, 1, 1);
 		cairo_move_to(ctx->cr, PAD, y);
 		cairo_show_text(ctx->cr, buf);
@@ -705,7 +705,7 @@ static void show_gpu_freq(struct overlay_context *ctx, struct overlay_gpu_freq *
 	}
 
 	if (has_irqs) {
-		sprintf(buf, "Interrupts: %llu", (long long unsigned)gf->irqs.delta);
+		sprintf(buf, "Interrupts: %'llu", (long long unsigned)gf->irqs.delta);
 		cairo_set_source_rgba(ctx->cr, 1, 1, 1, 1);
 		cairo_move_to(ctx->cr, PAD, y);
 		cairo_show_text(ctx->cr, buf);
diff --git a/tests/gem_exec_big.c b/tests/gem_exec_big.c
index 171fd81..7442578 100644
--- a/tests/gem_exec_big.c
+++ b/tests/gem_exec_big.c
@@ -213,13 +213,13 @@ igt_simple_main
 			ptr = NULL;
 
 		for (reloc_ofs = 4096; reloc_ofs < batch_size; reloc_ofs += 4096) {
-			igt_debug("batch_size %llu, reloc_ofs %llu\n",
+			igt_debug("batch_size %'llu, reloc_ofs %'llu\n",
 				  (long long)batch_size, (long long)reloc_ofs);
 			exec1(fd, handle, reloc_ofs, 0, ptr);
 			exec1(fd, handle, reloc_ofs, I915_EXEC_SECURE, ptr);
 		}
 
-		igt_debug("batch_size %llu, all %ld relocs\n",
+		igt_debug("batch_size %'llu, all %ld relocs\n",
 			  (long long)batch_size, (long)(batch_size >> 12));
 		execN(fd, handle, batch_size, 0, ptr);
 		execN(fd, handle, batch_size, I915_EXEC_SECURE, ptr);
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index b5cfda0..1e3bd56 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -637,7 +637,7 @@ int main(int argc, char **argv)
 				}
 
 				if (i < STATS_COUNT && HAS_STATS_REGS(devid)) {
-					printf("%13s: %llu (%lld/sec)",
+					printf("%13s: %'llu (%'lld/sec)",
 						   stats_reg_names[i],
 						   (long long)stats[i],
 						   (long long)(stats[i] - last_stats[i]));
-- 
2.4.4



More information about the Intel-gfx mailing list