]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
execute: dump CPUAffinity as a range string instead of a list of CPUs
authorMichal Sekletar <msekleta@redhat.com>
Fri, 31 May 2019 16:02:20 +0000 (18:02 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 3 Jun 2019 13:21:52 +0000 (15:21 +0200)
We do this already when printing the property in systemctl so be
consistent and do the same for systemd-analyze dump.

src/core/execute.c

index 8d00534ae516dc2834b488aa56bdba6109d7ece0..af994d97d1590a16b655d77d5829db4bd43cb35d 100644 (file)
@@ -4330,11 +4330,10 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
         }
 
         if (c->cpu_set.set) {
-                fprintf(f, "%sCPUAffinity:", prefix);
-                for (i = 0; i < c->cpu_set.allocated * 8; i++)
-                        if (CPU_ISSET_S(i, c->cpu_set.allocated, c->cpu_set.set))
-                                fprintf(f, " %u", i);
-                fputs("\n", f);
+                _cleanup_free_ char *affinity = NULL;
+
+                affinity = cpu_set_to_range_string(&c->cpu_set);
+                fprintf(f, "%sCPUAffinity: %s\n", prefix, affinity);
         }
 
         if (c->timer_slack_nsec != NSEC_INFINITY)