Thanks Andrew, let me try with this library and see how this works out.

FYI: Elapsed time/Duration  is calculated as follows: (End time-Start time) 
/frequency.  End time & start time is calculated from the performance counter 
and the frequency is obtained from the counter properties call.

Sai

From: Andrew Fish [mailto:af...@apple.com]
Sent: Friday, June 05, 2015 4:34 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] getsystemtime-- help


On Jun 5, 2015, at 4:29 PM, Andrew Fish 
<af...@apple.com<mailto:af...@apple.com>> wrote:


On Jun 5, 2015, at 4:21 PM, Andrew Fish 
<af...@apple.com<mailto:af...@apple.com>> wrote:


On Jun 5, 2015, at 4:13 PM, Saiprasad Chavali 
<s...@marvell.com<mailto:s...@marvell.com>> wrote:

Hi Andrew,

The “GetPerformanceCounter” is not working the way we want, the elapsed time 
varies, often from incremental value to decremented value.


For example the ACPI Timer version of the Timer lib rolls over every 3.54 
seconds. You may need a TSC version of the TimerLib to get good timing data.



https://svn.code.sf.net/p/edk2/code/trunk/edk2/DuetPkg/Library/DuetTimerLib/X86TimerLib.c

UINT64

EFIAPI

GetPerformanceCounterProperties (

  OUT      UINT64                    *StartValue,  OPTIONAL

  OUT      UINT64                    *EndValue     OPTIONAL

  )

{

  if (InternalGetApciDescrptionTable() == NULL) {

    return 0;

  }



  if (StartValue != NULL) {

    *StartValue = 0;

  }



  if (EndValue != NULL) {

    *EndValue = (1 << gAcpiDesc->PM_TMR_BLK.RegisterBitWidth) - 1;

  }



  return 3579545;

}
You may need to use an instance of the TimerLib that uses the X86 TSC, to get 
better quality performance profiling.

https://svn.code.sf.net/p/edk2/code/trunk/edk2/PerformancePkg/Library/TscTimerLib/

Thanks,

Andrew Fish


Thanks,

Andrew Fish


For example: I save the start time with a call to the API and periodically I 
call the API for End time. Measure the difference,  with a time out value. It 
fails

Observation, with repeated calls to “GetPerformancecounter”  the value 
returned, varies from high value to low than the saved Start Time. I don’t 
think this will work for us.

We need a value that increments in time like a system time call in windows 
“getsystemtime” in msecs.

Please suggest.


You need the correct TimerLib for your hardware. What TimerLib are you using?

Thanks,

Andrew Fish


Thanks
Sai

From: Saiprasad Chavali
Sent: Wednesday, June 03, 2015 9:49 PM
To: edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
Subject: RE: [edk2] getsystemtime-- help

Thanks Andrew, will try with “GetPerformanceCounter” and see how this works out.
The test bed at present is x86

Sai

From: Andrew Fish [mailto:af...@apple.com]
Sent: Wednesday, June 03, 2015 9:28 PM
To: edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
Subject: Re: [edk2] getsystemtime-- help


On Jun 3, 2015, at 9:22 PM, Saiprasad Chavali 
<s...@marvell.com<mailto:s...@marvell.com>> wrote:

Hi Andrew,

Trying to measure the elapsed time interval with a call to system time at 
different levels.


If you are writing platform code, or you know the platform.

https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Include/Library/PerformanceLib.h
Which a lot of times is built on:
https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Include/Library/TimerLib.h

On a PC the PerformanceCounter is usually the TSC (CPU register) or the ACPI 
Timer.

Thanks,

Andrew Fish

Thanks
Sai

From: Andrew Fish [mailto:af...@apple.com]
Sent: Wednesday, June 03, 2015 7:51 PM
To: edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
Subject: Re: [edk2] getsystemtime-- help


On Jun 3, 2015, at 7:47 PM, Saiprasad Chavali 
<s...@marvell.com<mailto:s...@marvell.com>> wrote:

Hi Andrew,

Thanks for the comment, is there way we can ping the RTC with the help of 
architecture protocol, at higher TPL’s than Callback (or) nothing?


The rules are the rules.

What are you trying to do?

Thanks,

Andrew Fish



Sai

From: Andrew Fish [mailto:af...@apple.com]
Sent: Wednesday, June 03, 2015 7:40 PM
To: edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
Subject: Re: [edk2] getsystemtime-- help


On Jun 3, 2015, at 7:27 PM, Saiprasad Chavali 
<s...@marvell.com<mailto:s...@marvell.com>> wrote:

HI,

Is there a better way to obtain the system time? I tried GetTime and the call 
hangs When I raise the TPL level.


Did you violate the TPL rules in the UEFI spec?

UEFI 2.5 section 6.1Table 23. TPL Restrictions
Time Services <= TPL_CALLBACK

If not it is a bug in the implementation of gRT->GetTime().

Thanks,

Andrew Fish




Thanks
Sai
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to