blob: 59a7bf60e242c4b8fe50a1a440e9d83551c90401 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/* SPDX-License-Identifier: MIT */
/*
* Copyright © 2024 Intel Corporation
*/
#ifndef _XE_GT_STATS_H_
#define _XE_GT_STATS_H_
#include <linux/ktime.h>
#include "xe_gt_stats_types.h"
struct xe_gt;
struct drm_printer;
#ifdef CONFIG_DEBUG_FS
int xe_gt_stats_print_info(struct xe_gt *gt, struct drm_printer *p);
void xe_gt_stats_clear(struct xe_gt *gt);
void xe_gt_stats_incr(struct xe_gt *gt, const enum xe_gt_stats_id id, int incr);
#else
static inline void
xe_gt_stats_incr(struct xe_gt *gt, const enum xe_gt_stats_id id,
int incr)
{
}
#endif
/**
* xe_gt_stats_ktime_us_delta() - Get delta in microseconds between now and a
* start time
* @start: Start time
*
* Helper for GT stats to get delta in microseconds between now and a start
* time, compiles out if GT stats are disabled.
*
* Return: Delta in microseconds between now and a start time
*/
static inline s64 xe_gt_stats_ktime_us_delta(ktime_t start)
{
return IS_ENABLED(CONFIG_DEBUG_FS) ?
ktime_us_delta(ktime_get(), start) : 0;
}
/**
* xe_gt_stats_ktime_get() - Get current ktime
*
* Helper for GT stats to get current ktime, compiles out if GT stats are
* disabled.
*
* Return: Get current ktime
*/
static inline ktime_t xe_gt_stats_ktime_get(void)
{
return IS_ENABLED(CONFIG_DEBUG_FS) ? ktime_get() : 0;
}
#endif
|