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

Commit 8f28827a authored by Frederic Weisbecker's avatar Frederic Weisbecker Committed by Ingo Molnar
Browse files

perf tools: Librarize trace_event() helper



Librarize trace_event() helper so that perf trace can use it
too. Also clean up the debug.h includes a bit.

It's not good to have it included in perf.h because it doesn't
make it flexible against other headers it may need (headers
that can also depend on perf.h and then create a recursive
header dependency).

Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1250453149-664-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 0d3a5c88
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
#include "util/string.h"
#include "util/string.h"


#include "perf.h"
#include "perf.h"
#include "util/debug.h"


#include "util/parse-options.h"
#include "util/parse-options.h"
#include "util/parse-events.h"
#include "util/parse-events.h"
+1 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


#include "util/header.h"
#include "util/header.h"
#include "util/event.h"
#include "util/event.h"
#include "util/debug.h"


#include <unistd.h>
#include <unistd.h>
#include <sched.h>
#include <sched.h>
+1 −38
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@
#include "util/values.h"
#include "util/values.h"


#include "perf.h"
#include "perf.h"
#include "util/debug.h"
#include "util/header.h"
#include "util/header.h"


#include "util/parse-options.h"
#include "util/parse-options.h"
@@ -39,8 +40,6 @@ static char *field_sep;
static int		input;
static int		input;
static int		show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
static int		show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;


#define cdprintf(x...)	do { if (dump_trace) color_fprintf(stdout, color, x); } while (0)

static int		full_paths;
static int		full_paths;
static int		show_nr_samples;
static int		show_nr_samples;


@@ -1285,42 +1284,6 @@ process_lost_event(event_t *event, unsigned long offset, unsigned long head)
	return 0;
	return 0;
}
}


static void trace_event(event_t *event)
{
	unsigned char *raw_event = (void *)event;
	const char *color = PERF_COLOR_BLUE;
	int i, j;

	if (!dump_trace)
		return;

	dump_printf(".");
	cdprintf("\n. ... raw event: size %d bytes\n", event->header.size);

	for (i = 0; i < event->header.size; i++) {
		if ((i & 15) == 0) {
			dump_printf(".");
			cdprintf("  %04x: ", i);
		}

		cdprintf(" %02x", raw_event[i]);

		if (((i & 15) == 15) || i == event->header.size-1) {
			cdprintf("  ");
			for (j = 0; j < 15-(i & 15); j++)
				cdprintf("   ");
			for (j = 0; j < (i & 15); j++) {
				if (isprint(raw_event[i-15+j]))
					cdprintf("%c", raw_event[i-15+j]);
				else
					cdprintf(".");
			}
			cdprintf("\n");
		}
	}
	dump_printf(".\n");
}

static int
static int
process_read_event(event_t *event, unsigned long offset, unsigned long head)
process_read_event(event_t *event, unsigned long offset, unsigned long head)
{
{
+2 −0
Original line number Original line Diff line number Diff line
@@ -42,6 +42,8 @@
#include "util/util.h"
#include "util/util.h"
#include "util/parse-options.h"
#include "util/parse-options.h"
#include "util/parse-events.h"
#include "util/parse-events.h"
#include "util/event.h"
#include "util/debug.h"


#include <sys/prctl.h>
#include <sys/prctl.h>
#include <math.h>
#include <math.h>
+2 −0
Original line number Original line Diff line number Diff line
@@ -27,6 +27,8 @@
#include "util/parse-options.h"
#include "util/parse-options.h"
#include "util/parse-events.h"
#include "util/parse-events.h"


#include "util/debug.h"

#include <assert.h>
#include <assert.h>
#include <fcntl.h>
#include <fcntl.h>


Loading