函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:kernel\events\core.c Create Date:2022-07-27 14:58:11
首页 Copyright©Brick

7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
/*
 * Lost/dropped samples logging
 */
void perf_log_lost_samples(struct perf_event *event, u64 lost)
{
    struct perf_output_handle handle;
    struct perf_sample_data sample;
    int ret;
 
    struct {
        struct perf_event_header    header;
        u64             lost;
    } lost_samples_event = {
        .header = {
            .type = PERF_RECORD_LOST_SAMPLES,
            .misc = 0,
            .size = sizeof(lost_samples_event),
        },
        .lost       = lost,
    };
 
    perf_event_header__init_id(&lost_samples_event.header, &sample, event);
 
    ret = perf_output_begin(&handle, event,
                lost_samples_event.header.size);
    if (ret)
        return;
 
    perf_output_put(&handle, lost_samples_event);
    perf_event__output_id_sample(event, &handle, &sample);
    perf_output_end(&handle);
}