[Intel-gfx] [RFC 12/14] drm/i915: Interface for controling engine stats collection

Chris Wilson chris at chris-wilson.co.uk
Tue Jul 18 15:22:28 UTC 2017


Quoting Tvrtko Ursulin (2017-07-18 15:36:16)
> +u64 intel_engine_get_current_busy_ns(struct intel_engine_cs *engine)
> +{
> +       unsigned long flags;
> +       u64 total;
> +
> +       spin_lock_irqsave(&engine->stats.lock, flags);
> +
> +       total = engine->stats.total;
> +
> +       /*
> +        * If the engine is executing something at the moment
> +        * add it to the total.
> +        */
> +       if (engine->stats.ref)
> +               total += ktime_get_real_ns() - engine->stats.start;
> +
> +       spin_unlock_irqrestore(&engine->stats.lock, flags);

Answers to another patch found here. I would say this is the other half
of the interface and should be kept together.
-Chris


More information about the Intel-gfx mailing list