Discussion:
[edk2] getsystemtime-- help
Saiprasad Chavali
2015-06-04 02:27:50 UTC
Permalink
HI,

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

Thanks
Sai
Andrew Fish
2015-06-04 02:39:56 UTC
Permalink
Post by Saiprasad Chavali
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
Post by Saiprasad Chavali
Thanks
Sai
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel <https://lists.sourceforge.net/lists/listinfo/edk2-devel>
Saiprasad Chavali
2015-06-04 02:47:41 UTC
Permalink
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?

Sai

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


On Jun 3, 2015, at 7:27 PM, Saiprasad Chavali <***@marvell.com<mailto:***@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
------------------------------------------------------------------------------
Andrew Fish
2015-06-04 02:51:14 UTC
Permalink
Post by Saiprasad Chavali
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
Post by Saiprasad Chavali
Sai
Sent: Wednesday, June 03, 2015 7:40 PM
Subject: Re: [edk2] getsystemtime-- help
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
https://lists.sourceforge.net/lists/listinfo/edk2-devel <https://lists.sourceforge.net/lists/listinfo/edk2-devel>
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel
Saiprasad Chavali
2015-06-04 04:22:39 UTC
Permalink
Hi Andrew,

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

Thanks
Sai

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


On Jun 3, 2015, at 7:47 PM, Saiprasad Chavali <***@marvell.com<mailto:***@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:***@apple.com]
Sent: Wednesday, June 03, 2015 7:40 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: Re: [edk2] getsystemtime-- help


On Jun 3, 2015, at 7:27 PM, Saiprasad Chavali <***@marvell.com<mailto:***@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-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel
Andrew Fish
2015-06-04 04:27:51 UTC
Permalink
Post by Saiprasad Chavali
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 <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 <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
Post by Saiprasad Chavali
Thanks
Sai
Sent: Wednesday, June 03, 2015 7:51 PM
Subject: Re: [edk2] getsystemtime-- help
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
Sent: Wednesday, June 03, 2015 7:40 PM
Subject: Re: [edk2] getsystemtime-- help
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
https://lists.sourceforge.net/lists/listinfo/edk2-devel <https://lists.sourceforge.net/lists/listinfo/edk2-devel>
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel <https://lists.sourceforge.net/lists/listinfo/edk2-devel>
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel <https://lists.sourceforge.net/lists/listinfo/edk2-devel>
Saiprasad Chavali
2015-06-04 04:49:03 UTC
Permalink
Thanks Andrew, will try with “GetPerformanceCounter” and see how this works out.
The test bed at present is x86

Sai

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


On Jun 3, 2015, at 9:22 PM, Saiprasad Chavali <***@marvell.com<mailto:***@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:***@apple.com]
Sent: Wednesday, June 03, 2015 7:51 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: Re: [edk2] getsystemtime-- help


On Jun 3, 2015, at 7:47 PM, Saiprasad Chavali <***@marvell.com<mailto:***@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:***@apple.com]
Sent: Wednesday, June 03, 2015 7:40 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: Re: [edk2] getsystemtime-- help


On Jun 3, 2015, at 7:27 PM, Saiprasad Chavali <***@marvell.com<mailto:***@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-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

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

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel
Saiprasad Chavali
2015-06-05 23:13:47 UTC
Permalink
Hi Andrew,

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

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.

Thanks
Sai

From: Saiprasad Chavali
Sent: Wednesday, June 03, 2015 9:49 PM
To: edk2-***@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:***@apple.com]
Sent: Wednesday, June 03, 2015 9:28 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: Re: [edk2] getsystemtime-- help


On Jun 3, 2015, at 9:22 PM, Saiprasad Chavali <***@marvell.com<mailto:***@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:***@apple.com]
Sent: Wednesday, June 03, 2015 7:51 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: Re: [edk2] getsystemtime-- help


On Jun 3, 2015, at 7:47 PM, Saiprasad Chavali <***@marvell.com<mailto:***@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:***@apple.com]
Sent: Wednesday, June 03, 2015 7:40 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: Re: [edk2] getsystemtime-- help


On Jun 3, 2015, at 7:27 PM, Saiprasad Chavali <***@marvell.com<mailto:***@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-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

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

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel
Andrew Fish
2015-06-05 23:21:22 UTC
Permalink
Post by Saiprasad Chavali
Hi Andrew,
The “GetPerformanceCounter” is not working the way we want, the elapsed time varies, often from incremental value to decremented value.
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
Post by Saiprasad Chavali
Thanks
Sai
From: Saiprasad Chavali
Sent: Wednesday, June 03, 2015 9:49 PM
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
Sent: Wednesday, June 03, 2015 9:28 PM
Subject: Re: [edk2] getsystemtime-- help
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 <https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Include/Library/PerformanceLib.h>
https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Include/Library/TimerLib.h <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
Sent: Wednesday, June 03, 2015 7:51 PM
Subject: Re: [edk2] getsystemtime-- help
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
Sent: Wednesday, June 03, 2015 7:40 PM
Subject: Re: [edk2] getsystemtime-- help
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
https://lists.sourceforge.net/lists/listinfo/edk2-devel <https://lists.sourceforge.net/lists/listinfo/edk2-devel>
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel <https://lists.sourceforge.net/lists/listinfo/edk2-devel>
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel <https://lists.sourceforge.net/lists/listinfo/edk2-devel>
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel
Saiprasad Chavali
2015-06-05 23:28:04 UTC
Permalink
Hi,

I am linking to “Duettimerlib” . I am testing the duetpackage on an x86 machine.

Thanks
Sai

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


On Jun 5, 2015, at 4:13 PM, Saiprasad Chavali <***@marvell.com<mailto:***@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: 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-***@lists.sourceforge.net<mailto:edk2-***@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:***@apple.com]
Sent: Wednesday, June 03, 2015 9:28 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: Re: [edk2] getsystemtime-- help


On Jun 3, 2015, at 9:22 PM, Saiprasad Chavali <***@marvell.com<mailto:***@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:***@apple.com]
Sent: Wednesday, June 03, 2015 7:51 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: Re: [edk2] getsystemtime-- help


On Jun 3, 2015, at 7:47 PM, Saiprasad Chavali <***@marvell.com<mailto:***@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:***@apple.com]
Sent: Wednesday, June 03, 2015 7:40 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: Re: [edk2] getsystemtime-- help


On Jun 3, 2015, at 7:27 PM, Saiprasad Chavali <***@marvell.com<mailto:***@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-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

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

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

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel
Andrew Fish
2015-06-05 23:29:01 UTC
Permalink
Post by Andrew Fish
Post by Saiprasad Chavali
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.

Thanks,

Andrew Fish
Post by Andrew Fish
Post by Saiprasad Chavali
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
Post by Saiprasad Chavali
Thanks
Sai
From: Saiprasad Chavali
Sent: Wednesday, June 03, 2015 9:49 PM
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
Sent: Wednesday, June 03, 2015 9:28 PM
Subject: Re: [edk2] getsystemtime-- help
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 <https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Include/Library/PerformanceLib.h>
https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Include/Library/TimerLib.h <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
Sent: Wednesday, June 03, 2015 7:51 PM
Subject: Re: [edk2] getsystemtime-- help
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
Sent: Wednesday, June 03, 2015 7:40 PM
Subject: Re: [edk2] getsystemtime-- help
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
https://lists.sourceforge.net/lists/listinfo/edk2-devel <https://lists.sourceforge.net/lists/listinfo/edk2-devel>
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel <https://lists.sourceforge.net/lists/listinfo/edk2-devel>
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel <https://lists.sourceforge.net/lists/listinfo/edk2-devel>
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel <https://lists.sourceforge.net/lists/listinfo/edk2-devel>
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel
Andrew Fish
2015-06-05 23:33:36 UTC
Permalink
Post by Andrew Fish
Post by Andrew Fish
Post by Saiprasad Chavali
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
Post by Andrew Fish
Thanks,
Andrew Fish
Post by Andrew Fish
Post by Saiprasad Chavali
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
Post by Saiprasad Chavali
Thanks
Sai
From: Saiprasad Chavali
Sent: Wednesday, June 03, 2015 9:49 PM
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
Sent: Wednesday, June 03, 2015 9:28 PM
Subject: Re: [edk2] getsystemtime-- help
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 <https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Include/Library/PerformanceLib.h>
https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Include/Library/TimerLib.h <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
Sent: Wednesday, June 03, 2015 7:51 PM
Subject: Re: [edk2] getsystemtime-- help
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
Sent: Wednesday, June 03, 2015 7:40 PM
Subject: Re: [edk2] getsystemtime-- help
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
https://lists.sourceforge.net/lists/listinfo/edk2-devel <https://lists.sourceforge.net/lists/listinfo/edk2-devel>
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel <https://lists.sourceforge.net/lists/listinfo/edk2-devel>
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel <https://lists.sourceforge.net/lists/listinfo/edk2-devel>
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel <https://lists.sourceforge.net/lists/listinfo/edk2-devel>
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel
Saiprasad Chavali
2015-06-05 23:42:39 UTC
Permalink
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:***@apple.com]
Sent: Friday, June 05, 2015 4:34 PM
To: edk2-***@lists.sourceforge.net
Subject: Re: [edk2] getsystemtime-- help


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


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


On Jun 5, 2015, at 4:13 PM, Saiprasad Chavali <***@marvell.com<mailto:***@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-***@lists.sourceforge.net<mailto:edk2-***@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:***@apple.com]
Sent: Wednesday, June 03, 2015 9:28 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: Re: [edk2] getsystemtime-- help


On Jun 3, 2015, at 9:22 PM, Saiprasad Chavali <***@marvell.com<mailto:***@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:***@apple.com]
Sent: Wednesday, June 03, 2015 7:51 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: Re: [edk2] getsystemtime-- help


On Jun 3, 2015, at 7:47 PM, Saiprasad Chavali <***@marvell.com<mailto:***@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:***@apple.com]
Sent: Wednesday, June 03, 2015 7:40 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: Re: [edk2] getsystemtime-- help


On Jun 3, 2015, at 7:27 PM, Saiprasad Chavali <***@marvell.com<mailto:***@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-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

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

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

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

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

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

Loading...