perf env: Also consider env->arch == NULL as local operation
authorArnaldo Carvalho de Melo <[email protected]>
Tue, 27 Nov 2018 14:45:49 +0000 (11:45 -0300)
committerArnaldo Carvalho de Melo <[email protected]>
Mon, 17 Dec 2018 17:54:02 +0000 (14:54 -0300)
We'll set a new machine field based on env->arch, which for live mode,
like with 'perf top' means we need to use uname() to figure the name of
the arch, fix perf_env__arch() to consider both (env == NULL) and
(env->arch == NULL) as local operation.

Cc: Adrian Hunter <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: David Ahern <[email protected]>
Cc: David S. Miller <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Leo Yan <[email protected]>
Cc: Mathieu Poirier <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Wang Nan <[email protected]>
Cc: [email protected] # 4.19
Link: https://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/util/env.c

index 59f38c7693f8648b7ce494edc864f09a0f6b09d5..4c23779e271a31ce66d0deeb527a658e0ae90ae7 100644 (file)
@@ -166,7 +166,7 @@ const char *perf_env__arch(struct perf_env *env)
        struct utsname uts;
        char *arch_name;
 
-       if (!env) { /* Assume local operation */
+       if (!env || !env->arch) { /* Assume local operation */
                if (uname(&uts) < 0)
                        return NULL;
                arch_name = uts.machine;