There is a similar lib API for SMI handlers: https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/SmmPeriodicSmiLib.h
/** This function returns the time in 100ns units since the periodic SMI handler function was called. If the periodic SMI handler was resumed through PeriodicSmiYield(), then the time returned is the time in 100ns units since PeriodicSmiYield() returned. @return The actual time in 100ns units that the periodic SMI handler has been executing. If this function is not called from within an enabled periodic SMI handler, then 0 is returned. **/ UINT64 EFIAPI PeriodicSmiExecutionTime ( VOID ); https://github.com/tianocore/edk2/blob/96d691166f07b7ed422f9536832edadc0aea35c9/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.c#L422 I agree that an elapsed time API based on the performance counter in the TimerLib would be a good addition to the TimerLib and would provide a common implementation of the feature. May need an input parameter to pass in the start time to measure from so it can work in BASE implementations that can not assume writable globals. Mike > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Michael > Brown > Sent: Thursday, July 6, 2023 8:47 AM > To: devel@edk2.groups.io; Henz, Patrick <patrick.h...@hpe.com> > Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Use Performance > Timer for XHCI Timeouts > > On 06/07/2023 15:19, Henz, Patrick wrote: > > I agree that XhcGetElapsedTime() would be better off in TimerLib, but I > wasn't sure how the community would feel about adding to the interface. > > My understanding is that the TimerLib API is not prescribed by any > standards document, and that this change would add a new function > without changing any existing functions and so would not break any > existing users of TimerLib. On that basis, I would be firmly in favour > of extending TimerLib to include this functionality. > > I will defer to actual EDK2 maintainers on this, however. :) > > Thanks, > > Michael > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106710): https://edk2.groups.io/g/devel/message/106710 Mute This Topic: https://groups.io/mt/99972791/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-