Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169536
b: refs/heads/master
c: 6beba7a
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and Ingo Molnar committed Oct 23, 2009
1 parent 75af5f6 commit 71608b4
Show file tree
Hide file tree
Showing 18 changed files with 115 additions and 117 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 802da5f2289bbe363acef084805195c11f453c48
refs/heads/master: 6beba7adbe092e63dfe8d09fbd1e3ec140474a13
3 changes: 1 addition & 2 deletions trunk/tools/perf/builtin-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ static int
process_mmap_event(event_t *event, unsigned long offset, unsigned long head)
{
struct map *map = map__new(&event->mmap, NULL, 0,
sizeof(struct sym_priv), symbol_filter,
verbose);
sizeof(struct sym_priv), symbol_filter);
struct thread *thread = threads__findnew(event->mmap.pid);

dump_printf("%p [%p]: PERF_RECORD_MMAP %d: [%p(%p) @ %p]: %s\n",
Expand Down
2 changes: 1 addition & 1 deletion trunk/tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ static int __cmd_record(int argc, const char **argv)

param.sched_priority = realtime_prio;
if (sched_setscheduler(0, SCHED_FIFO, &param)) {
printf("Could not set realtime priority.\n");
pr_err("Could not set realtime priority.\n");
exit(-1);
}
}
Expand Down
9 changes: 5 additions & 4 deletions trunk/tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,8 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
dump_printf("... chain: nr:%Lu\n", chain->nr);

if (validate_chain(chain, event) < 0) {
eprintf("call-chain problem with event, skipping it.\n");
pr_debug("call-chain problem with event, "
"skipping it.\n");
return 0;
}

Expand All @@ -700,7 +701,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
}

if (thread == NULL) {
eprintf("problem processing %d event, skipping it.\n",
pr_debug("problem processing %d event, skipping it.\n",
event->header.type);
return -1;
}
Expand Down Expand Up @@ -738,7 +739,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)

if (hist_entry__add(thread, map, sym, ip,
chain, level, period)) {
eprintf("problem incrementing symbol count, skipping event\n");
pr_debug("problem incrementing symbol count, skipping event\n");
return -1;
}

Expand All @@ -750,7 +751,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
static int
process_mmap_event(event_t *event, unsigned long offset, unsigned long head)
{
struct map *map = map__new(&event->mmap, cwd, cwdlen, 0, NULL, verbose);
struct map *map = map__new(&event->mmap, cwd, cwdlen, 0, NULL);
struct thread *thread = threads__findnew(event->mmap.pid);

dump_printf("%p [%p]: PERF_RECORD_MMAP %d/%d: [%p(%p) @ %p]: %s\n",
Expand Down
4 changes: 2 additions & 2 deletions trunk/tools/perf/builtin-sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1666,8 +1666,8 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
(long long)period);

if (thread == NULL) {
eprintf("problem processing %d event, skipping it.\n",
event->header.type);
pr_debug("problem processing %d event, skipping it.\n",
event->header.type);
return -1;
}

Expand Down
13 changes: 6 additions & 7 deletions trunk/tools/perf/builtin-timechart.c
Original file line number Diff line number Diff line change
Expand Up @@ -1162,12 +1162,10 @@ static int __cmd_timechart(void)
size = event->header.size;

if (!size || process_event(event) < 0) {

printf("%p [%p]: skipping unknown header type: %d\n",
(void *)(offset + head),
(void *)(long)(event->header.size),
event->header.type);

pr_warning("%p [%p]: skipping unknown header type: %d\n",
(void *)(offset + head),
(void *)(long)(event->header.size),
event->header.type);
/*
* assume we lost track of the stream, check alignment, and
* increment a single u64 in the hope to catch on again 'soon'.
Expand Down Expand Up @@ -1200,7 +1198,8 @@ static int __cmd_timechart(void)

write_svg_file(output_name);

printf("Written %2.1f seconds of trace to %s.\n", (last_time - first_time) / 1000000000.0, output_name);
pr_info("Written %2.1f seconds of trace to %s.\n",
(last_time - first_time) / 1000000000.0, output_name);

return rc;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ static int symbol_filter(struct map *map, struct symbol *sym)
static int parse_symbols(void)
{
if (dsos__load_kernel(vmlinux_name, sizeof(struct sym_entry),
symbol_filter, verbose, 1) <= 0)
symbol_filter, 1) <= 0)
return -1;

if (dump_symtab)
Expand Down
4 changes: 2 additions & 2 deletions trunk/tools/perf/builtin-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
(long long)period);

if (thread == NULL) {
eprintf("problem processing %d event, skipping it.\n",
event->header.type);
pr_debug("problem processing %d event, skipping it.\n",
event->header.type);
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion trunk/tools/perf/util/callchain.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ fill_node(struct callchain_node *node, struct ip_callchain *chain,
}
node->val_nr = chain->nr - start;
if (!node->val_nr)
printf("Warning: empty node in callchain tree\n");
pr_warning("Warning: empty node in callchain tree\n");
}

static void
Expand Down
4 changes: 2 additions & 2 deletions trunk/tools/perf/util/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
int verbose = 0;
int dump_trace = 0;

int eprintf(const char *fmt, ...)
int eprintf(int level, const char *fmt, ...)
{
va_list args;
int ret = 0;

if (verbose) {
if (verbose >= level) {
va_start(args, fmt);
ret = vfprintf(stderr, fmt, args);
va_end(args);
Expand Down
3 changes: 2 additions & 1 deletion trunk/tools/perf/util/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
extern int verbose;
extern int dump_trace;

int eprintf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
int eprintf(int level,
const char *fmt, ...) __attribute__((format(printf, 2, 3)));
int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
void trace_event(event_t *event);

Expand Down
3 changes: 1 addition & 2 deletions trunk/tools/perf/util/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ struct symbol;
typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);

struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen,
unsigned int sym_priv_size, symbol_filter_t filter,
int v);
unsigned int sym_priv_size, symbol_filter_t filter);
struct map *map__clone(struct map *self);
int map__overlap(struct map *l, struct map *r);
size_t map__fprintf(struct map *self, FILE *fp);
Expand Down
2 changes: 1 addition & 1 deletion trunk/tools/perf/util/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static struct perf_trace_event_type *events;
void perf_header__push_event(u64 id, const char *name)
{
if (strlen(name) > MAX_EVENT_NAME)
printf("Event %s will be truncated\n", name);
pr_warning("Event %s will be truncated\n", name);

if (!events) {
events = malloc(sizeof(struct perf_trace_event_type));
Expand Down
17 changes: 17 additions & 0 deletions trunk/tools/perf/util/include/linux/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,21 @@ simple_strtoul(const char *nptr, char **endptr, int base)
return strtoul(nptr, endptr, base);
}

#ifndef pr_fmt
#define pr_fmt(fmt) fmt
#endif

#define pr_err(fmt, ...) \
do { fprintf(stderr, pr_fmt(fmt), ##__VA_ARGS__); } while (0)
#define pr_warning(fmt, ...) \
do { fprintf(stderr, pr_fmt(fmt), ##__VA_ARGS__); } while (0)
#define pr_info(fmt, ...) \
do { fprintf(stderr, pr_fmt(fmt), ##__VA_ARGS__); } while (0)
#define pr_debug(fmt, ...) \
eprintf(1, pr_fmt(fmt), ##__VA_ARGS__)
#define pr_debugN(n, fmt, ...) \
eprintf(n, pr_fmt(fmt), ##__VA_ARGS__)
#define pr_debug2(fmt, ...) pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__)
#define pr_debug3(fmt, ...) pr_debugN(3, pr_fmt(fmt), ##__VA_ARGS__)

#endif
17 changes: 8 additions & 9 deletions trunk/tools/perf/util/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ static int strcommon(const char *pathname, char *cwd, int cwdlen)
}

struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen,
unsigned int sym_priv_size, symbol_filter_t filter,
int v)
unsigned int sym_priv_size, symbol_filter_t filter)
{
struct map *self = malloc(sizeof(*self));

Expand Down Expand Up @@ -58,16 +57,16 @@ struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen,
goto out_delete;

if (new_dso) {
int nr = dso__load(self->dso, self, filter, v);
int nr = dso__load(self->dso, self, filter);

if (nr < 0)
eprintf("Failed to open %s, continuing "
"without symbols\n",
self->dso->long_name);
pr_warning("Failed to open %s, continuing "
"without symbols\n",
self->dso->long_name);
else if (nr == 0)
eprintf("No symbols found in %s, maybe "
"install a debug package?\n",
self->dso->long_name);
pr_warning("No symbols found in %s, maybe "
"install a debug package?\n",
self->dso->long_name);
}

if (self->dso == vdso || anon)
Expand Down
Loading

0 comments on commit 71608b4

Please sign in to comment.