函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:kernel\trace\ring_buffer.c Create Date:2022-07-27 12:58:16
首页 Copyright©Brick

269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
#define for_each_buffer_cpu(buffer, cpu)        \
    for_each_cpu(cpu, buffer->cpumask)
 
#define TS_SHIFT    27
#define TS_MASK     ((1ULL << TS_SHIFT) - 1)
#define TS_DELTA_TEST   (~TS_MASK)
 
/**
 * ring_buffer_event_time_stamp - return the event's extended timestamp
 * @event: the event to get the timestamp of
 *
 * Returns the extended timestamp associated with a data event.
 * An extended time_stamp is a 64-bit timestamp represented
 * internally in a special way that makes the best use of space
 * contained within a ring buffer event.  This function decodes
 * it and maps it to a straight u64 value.
 */
u64 ring_buffer_event_time_stamp(struct ring_buffer_event *event)
{
    u64 ts;
 
    ts = event->array[0];
    ts <<= TS_SHIFT;
    ts += event->time_delta;
 
    return ts;
}