Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb7d0b3c authored by Kyle McMartin's avatar Kyle McMartin Committed by Arnaldo Carvalho de Melo
Browse files

perf tool: Fix gcc 4.6.0 issues



GCC 4.6.0 in Fedora rawhide turned up some compile errors in tools/perf
due to the -Werror=unused-but-set-variable flag.

I've gone through and annotated some of the assignments that had side
effects (ie: return value from a function) with the __used annotation,
and in some cases, just removed unused code.

In a few cases, we were assigning something useful, but not using it in
later parts of the function.

kyle@dreadnought:~/src% gcc --version
gcc (GCC) 4.6.0 20110122 (Red Hat 4.6.0-0.3)

Cc: Ingo Molnar <mingo@redhat.com>
LKML-Reference: <20110124161304.GK27353@bombadil.infradead.org>
Signed-off-by: default avatarKyle McMartin <kyle@redhat.com>
[ committer note: Fixed up the annotation fixes, as that code moved recently ]
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 1ff511e3
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -55,7 +55,7 @@ int bench_sched_pipe(int argc, const char **argv,
	 * discarding returned value of read(), write()
	 * discarding returned value of read(), write()
	 * causes error in building environment for perf
	 * causes error in building environment for perf
	 */
	 */
	int ret, wait_stat;
	int __used ret, wait_stat;
	pid_t pid, retpid;
	pid_t pid, retpid;


	argc = parse_options(argc, argv, options,
	argc = parse_options(argc, argv, options,
+3 −9
Original line number Original line Diff line number Diff line
@@ -369,11 +369,6 @@ static void
process_sched_event(struct task_desc *this_task __used, struct sched_atom *atom)
process_sched_event(struct task_desc *this_task __used, struct sched_atom *atom)
{
{
	int ret = 0;
	int ret = 0;
	u64 now;
	long long delta;

	now = get_nsecs();
	delta = start_time + atom->timestamp - now;


	switch (atom->type) {
	switch (atom->type) {
		case SCHED_EVENT_RUN:
		case SCHED_EVENT_RUN:
@@ -562,7 +557,7 @@ static void wait_for_tasks(void)


static void run_one_test(void)
static void run_one_test(void)
{
{
	u64 T0, T1, delta, avg_delta, fluct, std_dev;
	u64 T0, T1, delta, avg_delta, fluct;


	T0 = get_nsecs();
	T0 = get_nsecs();
	wait_for_tasks();
	wait_for_tasks();
@@ -578,7 +573,6 @@ static void run_one_test(void)
	else
	else
		fluct = delta - avg_delta;
		fluct = delta - avg_delta;
	sum_fluct += fluct;
	sum_fluct += fluct;
	std_dev = sum_fluct / nr_runs / sqrt(nr_runs);
	if (!run_avg)
	if (!run_avg)
		run_avg = delta;
		run_avg = delta;
	run_avg = (run_avg*9 + delta)/10;
	run_avg = (run_avg*9 + delta)/10;
@@ -799,7 +793,7 @@ replay_switch_event(struct trace_switch_event *switch_event,
		    u64 timestamp,
		    u64 timestamp,
		    struct thread *thread __used)
		    struct thread *thread __used)
{
{
	struct task_desc *prev, *next;
	struct task_desc *prev, __used *next;
	u64 timestamp0;
	u64 timestamp0;
	s64 delta;
	s64 delta;


@@ -1404,7 +1398,7 @@ map_switch_event(struct trace_switch_event *switch_event,
		 u64 timestamp,
		 u64 timestamp,
		 struct thread *thread __used)
		 struct thread *thread __used)
{
{
	struct thread *sched_out, *sched_in;
	struct thread *sched_out __used, *sched_in;
	int new_shortname;
	int new_shortname;
	u64 timestamp0;
	u64 timestamp0;
	s64 delta;
	s64 delta;
+1 −1
Original line number Original line Diff line number Diff line
@@ -865,7 +865,7 @@ static int __cmd_top(void)
{
{
	pthread_t thread;
	pthread_t thread;
	struct perf_evsel *first;
	struct perf_evsel *first;
	int ret;
	int ret __used;
	/*
	/*
	 * FIXME: perf_session__new should allow passing a O_MMAP, so that all this
	 * FIXME: perf_session__new should allow passing a O_MMAP, so that all this
	 * mmap reading, etc is encapsulated in it. Use O_WRONLY for now.
	 * mmap reading, etc is encapsulated in it. Use O_WRONLY for now.
+0 −3
Original line number Original line Diff line number Diff line
@@ -236,7 +236,6 @@ int symbol__annotate(struct symbol *sym, struct map *map,
	char command[PATH_MAX * 2];
	char command[PATH_MAX * 2];
	FILE *file;
	FILE *file;
	int err = 0;
	int err = 0;
	u64 len;
	char symfs_filename[PATH_MAX];
	char symfs_filename[PATH_MAX];


	if (filename) {
	if (filename) {
@@ -281,8 +280,6 @@ int symbol__annotate(struct symbol *sym, struct map *map,
		 filename, sym->name, map->unmap_ip(map, sym->start),
		 filename, sym->name, map->unmap_ip(map, sym->start),
		 map->unmap_ip(map, sym->end));
		 map->unmap_ip(map, sym->end));


	len = sym->end - sym->start;

	pr_debug("annotating [%p] %30s : [%p] %30s\n",
	pr_debug("annotating [%p] %30s : [%p] %30s\n",
		 dso, dso->long_name, sym, sym->name);
		 dso, dso->long_name, sym, sym->name);


+1 −1
Original line number Original line Diff line number Diff line
@@ -1145,7 +1145,7 @@ int perf_event__synthesize_tracing_data(int fd, struct perf_evlist *evlist,
{
{
	union perf_event ev;
	union perf_event ev;
	ssize_t size = 0, aligned_size = 0, padding;
	ssize_t size = 0, aligned_size = 0, padding;
	int err = 0;
	int err __used = 0;


	memset(&ev, 0, sizeof(ev));
	memset(&ev, 0, sizeof(ev));


Loading