if (type & PERF_SAMPLE_TID) {
COMP(pid);
COMP(tid);
}
if (type & PERF_SAMPLE_TIME)
COMP(time);
if (type & PERF_SAMPLE_ADDR)
COMP(addr);
if (type & PERF_SAMPLE_ID)
COMP(id);
if (type & PERF_SAMPLE_STREAM_ID)
COMP(stream_id);
if (type & PERF_SAMPLE_CPU)
COMP(cpu);
if (type & PERF_SAMPLE_PERIOD)
COMP(period);
if (type & PERF_SAMPLE_READ) { if (read_format & PERF_FORMAT_GROUP)
COMP(read.group.nr); else
COMP(read.one.value); if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)
COMP(read.time_enabled); if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING)
COMP(read.time_running); /* PERF_FORMAT_ID is forced for PERF_SAMPLE_READ */ if (read_format & PERF_FORMAT_GROUP) { for (i = 0; i < s1->read.group.nr; i++) { /* FIXME: check values without LOST */ if (read_format & PERF_FORMAT_LOST)
MCOMP(read.group.values[i]);
}
} else {
COMP(read.one.id); if (read_format & PERF_FORMAT_LOST)
COMP(read.one.lost);
}
}
if (type & PERF_SAMPLE_CALLCHAIN) {
COMP(callchain->nr); for (i = 0; i < s1->callchain->nr; i++)
COMP(callchain->ips[i]);
}
if (type & PERF_SAMPLE_RAW) {
COMP(raw_size); if (memcmp(s1->raw_data, s2->raw_data, s1->raw_size)) {
pr_debug("Samples differ at 'raw_data'\n"); returnfalse;
}
}
if (type & PERF_SAMPLE_BRANCH_STACK) {
COMP(branch_stack->nr);
COMP(branch_stack->hw_idx); for (i = 0; i < s1->branch_stack->nr; i++) { if (needs_swap) return ((host_is_bigendian()) ?
(FLAG(s2).value == BS_EXPECTED_BE) :
(FLAG(s2).value == BS_EXPECTED_LE)); else
MCOMP(branch_stack->entries[i]);
}
}
/* The data does not contain 0xff so we use that to check the size */ for (i = bufsz; i > 0; i--) { if (*(i - 1 + (u8 *)event) != 0xff) break;
} if (i != sz) {
pr_debug("Event size mismatch: actual %zu vs expected %zu\n",
i, sz); goto out_free;
}
/* *Failthetestifithasnotbeenupdatedwhennewsampleformatbits *wereadded.Pleaseactuallyupdatethetestratherthanjustchange *theconditionbelow.
*/ if (PERF_SAMPLE_MAX > PERF_SAMPLE_WEIGHT_STRUCT << 1) {
pr_debug("sample format has changed, some new PERF_SAMPLE_ bit was introduced - test needs updating\n"); return -1;
}
/* Test each sample format bit separately */ for (sample_type = 1; sample_type != PERF_SAMPLE_MAX;
sample_type <<= 1) { /* Test read_format variations */ if (sample_type == PERF_SAMPLE_READ) { for (i = 0; i < ARRAY_SIZE(rf); i++) {
err = do_test(sample_type, 0, rf[i]); if (err) return err;
} continue;
}
sample_regs = 0;
if (sample_type == PERF_SAMPLE_REGS_USER)
sample_regs = 0x3fff;
if (sample_type == PERF_SAMPLE_REGS_INTR)
sample_regs = 0xff0fff;
err = do_test(sample_type, sample_regs, 0); if (err) return err;
}
/* *Testallsampleformatbitstogether *Note:PERF_SAMPLE_WEIGHTandPERF_SAMPLE_WEIGHT_STRUCTcannot *besetsimultaneously.
*/
sample_type = (PERF_SAMPLE_MAX - 1) & ~PERF_SAMPLE_WEIGHT;
sample_regs = 0x3fff; /* shared yb intr and user regs */ for (i = 0; i < ARRAY_SIZE(rf); i++) {
err = do_test(sample_type, sample_regs, rf[i]); if (err) return err;
}
sample_type = (PERF_SAMPLE_MAX - 1) & ~PERF_SAMPLE_WEIGHT_STRUCT; for (i = 0; i < ARRAY_SIZE(rf); i++) {
err = do_test(sample_type, sample_regs, rf[i]); if (err) return err;
}
return0;
}
DEFINE_SUITE("Sample parsing", sample_parsing);
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-10-11)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.