Skip to contentSkip to conversation

perftools: Fix return values checking and build on older glibc

PATCH In review Han Pingtian 1 participant 2 messages Jan 24, 2011 – Jan 28, 2011 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perftools: Fix return values checking and build on older glibc

Just like 57b84e53171ce, port the fixing to test__open_syscall_event_on_all_cpus() to test__basic_mmap(). And check to right return values.

---
 tools/perf/builtin-test.c |   24 +++++++-----------------
 1 files changed, 7 insertions(+), 17 deletions(-)
tools/perf/builtin-test.c +7 -17
index 4b0ef5f..4fac856 100644
@@ -456,8 +456,7 @@ static int test__basic_mmap(void)
 		.sample_type	= PERF_SAMPLE_ID,
 		.watermark	= 0,
 	};
-	cpu_set_t *cpu_set;
-	size_t cpu_set_size;
+	cpu_set_t cpu_set;
 	const char *syscall_names[] = { "getsid", "getppid", "getpgrp",
 					"getpgid", };
 	pid_t (*syscalls[])(void) = { (void *)getsid, getppid, getpgrp,
@@ -488,26 +487,17 @@ static int test__basic_mmap(void)
 	}
 
 	cpus = cpu_map__new(NULL);
-	if (threads == NULL) {
-		pr_debug("thread_map__new\n");
+	if (cpus == NULL) {
+		pr_debug("cpu_map__new\n");
 		goto out_free_threads;
 	}
 
-	cpu_set = CPU_ALLOC(cpus->nr);
-
-	if (cpu_set == NULL) {
-		pr_debug("thread_map__new\n");
-		goto out_free_cpus;
-	}
-
-	cpu_set_size = CPU_ALLOC_SIZE(cpus->nr);
-	CPU_ZERO_S(cpu_set_size, cpu_set);
-	CPU_SET(cpus->map[0], cpu_set);
-	sched_setaffinity(0, cpu_set_size, cpu_set);
-	CPU_FREE(cpu_set);
+	CPU_ZERO(&cpu_set);
+	CPU_SET(cpus->map[0], &cpu_set);
+	sched_setaffinity(0, sizeof(cpu_set), &cpu_set);
 
 	evlist = perf_evlist__new();
-	if (threads == NULL) {
+	if (evlist == NULL) {
 		pr_debug("perf_evlist__new\n");
 		goto out_free_cpus;
 	}
Signature · 1 line
1.7.3.4
#1 lore raw

[tip:perf/core] perf test: Fix return values checking

Commit-ID:  54489c189b1a0c10eaf21c6d2c5916b50442c871
Gitweb:     http://git.kernel.org/tip/54489c189b1a0c10eaf21c6d2c5916b50442c871
Author:     Han Pingtian <[email protected]>
AuthorDate: Tue, 25 Jan 2011 07:39:00 +0800
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 28 Jan 2011 09:21:19 -0200

perf test: Fix return values checking

Fixing some cut'n'paste mistakes.

LKML-Reference: <[email protected]>

[ committer note: I had already removed the CPU_ALLOC calls ]
---
 tools/perf/builtin-test.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
tools/perf/builtin-test.c +3 -3
index 231e3e2..738830d 100644
@@ -495,8 +495,8 @@ static int test__basic_mmap(void)
 	}
 
 	cpus = cpu_map__new(NULL);
-	if (threads == NULL) {
-		pr_debug("thread_map__new\n");
+	if (cpus == NULL) {
+		pr_debug("cpu_map__new\n");
 		goto out_free_threads;
 	}
 
@@ -510,7 +510,7 @@ static int test__basic_mmap(void)
 	}
 
 	evlist = perf_evlist__new();
-	if (threads == NULL) {
+	if (evlist == NULL) {
 		pr_debug("perf_evlist__new\n");
 		goto out_free_cpus;
 	}