Skip to contentSkip to conversation

perf env: Also consider env->arch == NULL as local operation

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Dec 14, 2018 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  ea75be393677d60dd64b976f8fc91763537b13c7
Gitweb:     https://git.kernel.org/tip/ea75be393677d60dd64b976f8fc91763537b13c7
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Tue, 27 Nov 2018 11:45:49 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 29 Nov 2018 20:42:47 -0300

perf env: Also consider env->arch == NULL as local operation

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.

---
 tools/perf/util/env.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/env.c +1 -1
index 59f38c7693f8..4c23779e271a 100644
@@ -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;