Quoting Matthew Auld (2020-11-27 12:06:50) > From: Sudeep Dutt <sudeep.dutt@xxxxxxxxx> > > Signed-off-by: Sudeep Dutt <sudeep.dutt@xxxxxxxxx> > --- > drivers/gpu/drm/i915/gem/i915_gem_region.c | 16 ++++++++++++++-- > drivers/gpu/drm/i915/i915_debugfs.c | 3 +++ > drivers/gpu/drm/i915/i915_drv.h | 2 ++ > 3 files changed, 19 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_region.c b/drivers/gpu/drm/i915/gem/i915_gem_region.c > index ed108dbcb34e..4fab9f6b4bee 100644 > --- a/drivers/gpu/drm/i915/gem/i915_gem_region.c > +++ b/drivers/gpu/drm/i915/gem/i915_gem_region.c > @@ -15,6 +15,7 @@ i915_gem_object_swapout_pages(struct drm_i915_gem_object *obj, > { > struct drm_i915_private *i915 = to_i915(obj->base.dev); > struct drm_i915_gem_object *dst, *src; > + unsigned long start, diff, msec; > int err; > > GEM_BUG_ON(obj->swapto); > @@ -24,6 +25,7 @@ i915_gem_object_swapout_pages(struct drm_i915_gem_object *obj, > GEM_BUG_ON(!i915->params.enable_eviction); > > assert_object_held(obj); > + start = jiffies; > > /* create a shadow object on smem region */ > dst = i915_gem_object_create_shmem(i915, obj->base.size); > @@ -64,8 +66,12 @@ i915_gem_object_swapout_pages(struct drm_i915_gem_object *obj, > else > i915_gem_object_put(dst); > > - if (!err) > + if (!err) { > + diff = jiffies - start; > + msec = diff * 1000 / HZ; > + atomic_long_add(msec, &i915->time_swap_out_ms); > atomic_long_add(sizes, &i915->num_bytes_swapped_out); > + } This can be done using a kprobe, and with prettier statistics as builtin functionality. -Chris _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx