Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #ifndef __PERF_EVENTS_STATS_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #define __PERF_EVENTS_STATS_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #include <stdio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <perf/event.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include "auxtrace.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  * The kernel collects the number of events it couldn't send in a stretch and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  * when possible sends this number in a PERF_RECORD_LOST event. The number of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  * such "chunks" of lost events is stored in .nr_events[PERF_EVENT_LOST] while
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  * total_lost tells exactly how many events the kernel in fact lost, i.e. it is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  * the sum of all struct perf_record_lost.lost fields reported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  * The kernel discards mixed up samples and sends the number in a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)  * PERF_RECORD_LOST_SAMPLES event. The number of lost-samples events is stored
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)  * in .nr_events[PERF_RECORD_LOST_SAMPLES] while total_lost_samples tells
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)  * exactly how many samples the kernel in fact dropped, i.e. it is the sum of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)  * all struct perf_record_lost_samples.lost fields reported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)  * The total_period is needed because by default auto-freq is used, so
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)  * multipling nr_events[PERF_EVENT_SAMPLE] by a frequency isn't possible to get
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)  * the total number of low level events, it is necessary to to sum all struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)  * perf_record_sample.period and stash the result in total_period.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct events_stats {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	u64 total_period;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	u64 total_non_filtered_period;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	u64 total_lost;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	u64 total_lost_samples;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	u64 total_aux_lost;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	u64 total_aux_partial;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	u64 total_invalid_chains;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	u32 nr_events[PERF_RECORD_HEADER_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	u32 nr_non_filtered_samples;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	u32 nr_lost_warned;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	u32 nr_unknown_events;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	u32 nr_invalid_chains;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	u32 nr_unknown_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	u32 nr_unprocessable_samples;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	u32 nr_auxtrace_errors[PERF_AUXTRACE_ERROR_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	u32 nr_proc_map_timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) void events_stats__inc(struct events_stats *stats, u32 type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) size_t events_stats__fprintf(struct events_stats *stats, FILE *fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #endif /* __PERF_EVENTS_STATS_ */