perf tools: Include file offset and event type name in skip messages

Add the perf.data file offset and use perf_event__name() instead of raw
event type integers in the 'problem processing event, skipping it'
messages emitted by process_sample_event() callbacks across annotate,
c2c, diff, kmem, kvm, kwork, lock, report, script, and build-id.

This lets users cross-reference skipped events with 'perf report -D'
output.  Also add explicit #include "util/event.h" and <inttypes.h>
where needed to avoid depending on transitive includes.

Reviewed-by: Ian Rogers <irogers@google.com>
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2026-06-01 15:21:20 -03:00
parent 4cd74dee09
commit 865224bfde
10 changed files with 43 additions and 24 deletions

View File

@ -288,8 +288,9 @@ static int process_sample_event(const struct perf_tool *tool,
addr_location__init(&al);
if (machine__resolve(machine, &al, sample) < 0) {
pr_warning("problem processing %d event, skipping it.\n",
event->header.type);
pr_warning("problem processing %s (%u) event at offset %#" PRIx64 ", skipping it.\n",
perf_event__name(event->header.type), event->header.type,
sample->file_offset);
ret = -1;
goto out_put;
}

View File

@ -328,8 +328,9 @@ static int process_sample_event(const struct perf_tool *tool __maybe_unused,
addr_location__init(&al);
if (machine__resolve(machine, &al, sample) < 0) {
pr_debug("problem processing %d event, skipping it.\n",
event->header.type);
pr_debug("problem processing %s (%u) event at offset %#" PRIx64 ", skipping it.\n",
perf_event__name(event->header.type), event->header.type,
sample->file_offset);
ret = -1;
goto out;
}

View File

@ -409,8 +409,9 @@ static int diff__process_sample_event(const struct perf_tool *tool,
addr_location__init(&al);
if (machine__resolve(machine, &al, sample) < 0) {
pr_warning("problem processing %d event, skipping it.\n",
event->header.type);
pr_warning("problem processing %s (%u) event at offset %#" PRIx64 ", skipping it.\n",
perf_event__name(event->header.type), event->header.type,
sample->file_offset);
ret = -1;
goto out;
}
@ -436,7 +437,8 @@ static int diff__process_sample_event(const struct perf_tool *tool,
case COMPUTE_STREAM:
if (hist_entry_iter__add(&iter, &al, PERF_MAX_STACK_DEPTH,
NULL)) {
pr_debug("problem adding hist entry, skipping event\n");
pr_debug("problem adding hist entry at offset %#" PRIx64 ", skipping event\n",
sample->file_offset);
goto out;
}
break;

View File

@ -22,6 +22,7 @@
#include "util/cpumap.h"
#include "util/debug.h"
#include "util/event.h"
#include "util/string2.h"
#include "util/util.h"
@ -987,8 +988,9 @@ static int process_sample_event(const struct perf_tool *tool __maybe_unused,
sample->tid);
if (thread == NULL) {
pr_debug("problem processing %d event, skipping it.\n",
event->header.type);
pr_debug("problem processing %s (%u) event at offset %#" PRIx64 ", skipping it.\n",
perf_event__name(event->header.type), event->header.type,
sample->file_offset);
return -1;
}

View File

@ -22,6 +22,7 @@
#include "util/synthetic-events.h"
#include "util/top.h"
#include "util/data.h"
#include "util/event.h"
#include "util/ordered-events.h"
#include "util/kvm-stat.h"
#include "util/util.h"
@ -1141,14 +1142,16 @@ static int process_sample_event(const struct perf_tool *tool,
return 0;
if (machine__resolve(machine, &kvm->al, sample) < 0) {
pr_warning("Fail to resolve address location, skip sample.\n");
pr_warning("WARNING: at offset %#" PRIx64 ": fail to resolve address location, skipping sample\n",
sample->file_offset);
return 0;
}
thread = machine__findnew_thread(machine, sample->pid, sample->tid);
if (thread == NULL) {
pr_debug("problem processing %d event, skipping it.\n",
event->header.type);
pr_debug("problem processing %s (%u) event at offset %#" PRIx64 ", skipping it.\n",
perf_event__name(event->header.type), event->header.type,
sample->file_offset);
return -1;
}

View File

@ -9,6 +9,7 @@
#include "perf.h"
#include "util/data.h"
#include "util/event.h"
#include "util/evlist.h"
#include "util/evsel.h"
#include "util/header.h"
@ -897,7 +898,8 @@ static int timehist_exit_event(struct perf_kwork *kwork,
addr_location__init(&al);
if (machine__resolve(machine, &al, sample) < 0) {
pr_debug("Problem processing event, skipping it\n");
pr_debug("problem processing event at offset %#" PRIx64 ", skipping it\n",
sample->file_offset);
ret = -1;
goto out;
}

View File

@ -21,6 +21,7 @@
#include "util/tracepoint.h"
#include "util/debug.h"
#include "util/event.h"
#include "util/session.h"
#include "util/tool.h"
#include "util/data.h"
@ -1433,8 +1434,9 @@ static int process_sample_event(const struct perf_tool *tool __maybe_unused,
sample->tid);
if (thread == NULL) {
pr_debug("problem processing %d event, skipping it.\n",
event->header.type);
pr_debug("problem processing %s (%u) event at offset %#" PRIx64 ", skipping it.\n",
perf_event__name(event->header.type), event->header.type,
sample->file_offset);
return -1;
}

View File

@ -27,6 +27,7 @@
#include "perf.h"
#include "util/debug.h"
#include "util/event.h"
#include "util/evlist.h"
#include "util/evsel.h"
#include "util/evswitch.h"
@ -284,8 +285,9 @@ static int process_sample_event(const struct perf_tool *tool,
addr_location__init(&al);
if (machine__resolve(machine, &al, sample) < 0) {
pr_debug("problem processing %d event, skipping it.\n",
event->header.type);
pr_debug("problem processing %s (%u) event at offset %#" PRIx64 ", skipping it.\n",
perf_event__name(event->header.type), event->header.type,
sample->file_offset);
ret = -1;
goto out_put;
}
@ -332,7 +334,8 @@ static int process_sample_event(const struct perf_tool *tool,
ret = hist_entry_iter__add(&iter, &al, rep->max_stack, rep);
if (ret < 0)
pr_debug("problem adding hist entry, skipping event\n");
pr_debug("problem adding hist entry at offset %#" PRIx64 ", skipping event\n",
sample->file_offset);
out_put:
addr_location__exit(&al);
return ret;

View File

@ -2693,8 +2693,9 @@ static int process_sample_event(const struct perf_tool *tool,
goto out_put;
if (!al.thread && machine__resolve(machine, &al, sample) < 0) {
pr_err("problem processing %d event, skipping it.\n",
event->header.type);
pr_err("problem processing %s (%u) event at offset %#" PRIx64 ", skipping it.\n",
perf_event__name(event->header.type), event->header.type,
sample->file_offset);
ret = -1;
goto out_put;
}
@ -2775,8 +2776,9 @@ static int process_deferred_sample_event(const struct perf_tool *tool,
goto out_put;
if (machine__resolve(machine, &al, sample) < 0) {
pr_err("problem processing %d event, skipping it.\n",
event->header.type);
pr_err("problem processing %s (%u) event at offset %#" PRIx64 ", skipping it.\n",
perf_event__name(event->header.type), event->header.type,
sample->file_offset);
ret = -1;
goto out_put;
}

View File

@ -10,6 +10,7 @@
#include "util.h" // lsdir(), mkdir_p(), rm_rf()
#include <dirent.h>
#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
@ -62,8 +63,8 @@ int build_id__mark_dso_hit(const struct perf_tool *tool __maybe_unused,
sample->tid);
if (thread == NULL) {
pr_err("problem processing %d event, skipping it.\n",
event->header.type);
pr_err("problem processing %s event at offset %#" PRIx64 ", skipping it.\n",
perf_event__name(event->header.type), sample->file_offset);
return -1;
}