Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v6.17-rc7 52 lines 1.2 kB view raw
1// SPDX-License-Identifier: MIT 2/* 3 * Copyright © 2024 Intel Corporation 4 */ 5 6#include <linux/atomic.h> 7 8#include <drm/drm_print.h> 9 10#include "xe_gt.h" 11#include "xe_gt_stats.h" 12 13/** 14 * xe_gt_stats_incr - Increments the specified stats counter 15 * @gt: GT structure 16 * @id: xe_gt_stats_id type id that needs to be incremented 17 * @incr: value to be incremented with 18 * 19 * Increments the specified stats counter. 20 */ 21void xe_gt_stats_incr(struct xe_gt *gt, const enum xe_gt_stats_id id, int incr) 22{ 23 if (id >= __XE_GT_STATS_NUM_IDS) 24 return; 25 26 atomic64_add(incr, &gt->stats.counters[id]); 27} 28 29static const char *const stat_description[__XE_GT_STATS_NUM_IDS] = { 30 "svm_pagefault_count", 31 "tlb_inval_count", 32 "vma_pagefault_count", 33 "vma_pagefault_kb", 34}; 35 36/** 37 * xe_gt_stats_print_info - Print the GT stats 38 * @gt: GT structure 39 * @p: drm_printer where it will be printed out. 40 * 41 * This prints out all the available GT stats. 42 */ 43int xe_gt_stats_print_info(struct xe_gt *gt, struct drm_printer *p) 44{ 45 enum xe_gt_stats_id id; 46 47 for (id = 0; id < __XE_GT_STATS_NUM_IDS; ++id) 48 drm_printf(p, "%s: %lld\n", stat_description[id], 49 atomic64_read(&gt->stats.counters[id])); 50 51 return 0; 52}