modules/portlib/src/main/native/port/windows/hytime.c File Reference


Detailed Description

Timer utilities.

#include <windows.h>
#include "hyport.h"
#include "portpriv.h"
#include "hyportpg.h"

Functions

UDATA VMCALL hytime_msec_clock (struct HyPortLibrary *portLibrary)
 Query OS for timestamp.
UDATA VMCALL hytime_usec_clock (struct HyPortLibrary *portLibrary)
 Query OS for timestamp.
I_64 VMCALL hytime_current_time_millis (struct HyPortLibrary *portLibrary)
 Query OS for timestamp.
U_64 VMCALL hytime_hires_clock (struct HyPortLibrary *portLibrary)
 Query OS for timestamp.
U_64 VMCALL hytime_hires_frequency (struct HyPortLibrary *portLibrary)
 Query OS for clock frequency Retrieves the frequency of the high-resolution performance counter.
U_64 VMCALL hytime_hires_delta (struct HyPortLibrary *portLibrary, U_64 startTime, U_64 endTime, UDATA requiredResolution)
 Calculate time difference between two hires clock timer values hytime_hires_clock.
void VMCALL hytime_shutdown (struct HyPortLibrary *portLibrary)
 PortLibrary shutdown.
I_32 VMCALL hytime_startup (struct HyPortLibrary *portLibrary)
 PortLibrary startup.


Function Documentation

I_64 VMCALL hytime_current_time_millis ( struct HyPortLibrary portLibrary  ) 

Query OS for timestamp.

Retrieve the current value of system clock and convert to milliseconds since January 1st 1970.

Parameters:
[in] portLibrary The port library.
Returns:
0 on failure, time value in milliseconds on success.

U_64 VMCALL hytime_hires_clock ( struct HyPortLibrary portLibrary  ) 

Query OS for timestamp.

Retrieve the current value of the high-resolution performance counter.

Parameters:
[in] portLibrary The port library.
Returns:
0 on failure, time value on success.

U_64 VMCALL hytime_hires_delta ( struct HyPortLibrary portLibrary,
U_64  startTime,
U_64  endTime,
UDATA  requiredResolution 
)

Calculate time difference between two hires clock timer values hytime_hires_clock.

Given a start and end time determine how much time elapsed. Return the value as requested by the required resolution

Parameters:
[in] portLibrary The port library.
[in] startTime Timer value at start of timing interval
[in] endTime Timer value at end of timing interval
[in] requiredResolution Returned timer resolution as a fraction of a second. For example:
  • 1 to report elapsed time in seconds
  • 1,000 to report elapsed time in milliseconds
  • 1,000,000 to report elapsed time in microseconds
Returns:
0 on failure, time difference on success.
Note:
helper macros are available for commonly requested resolution
  • HYPORT_TIME_DELTA_IN_SECONDS return timer value in seconds.
  • HYPORT_TIME_DELTA_IN_MILLISECONDS return timer value in milliseconds.
  • HYPORT_TIME_DELTA_IN_MICROSECONDS return timer value in micoseconds.
  • HYPORT_TIME_DELTA_IN_NANOSECONDS return timer value in nanoseconds.

U_64 VMCALL hytime_hires_frequency ( struct HyPortLibrary portLibrary  ) 

Query OS for clock frequency Retrieves the frequency of the high-resolution performance counter.

Parameters:
[in] portLibrary The port library.
Returns:
0 on failure, number of ticks per second on success.

UDATA VMCALL hytime_msec_clock ( struct HyPortLibrary portLibrary  ) 

Query OS for timestamp.

Retrieve the current value of system clock and convert to milliseconds.

Parameters:
[in] portLibrary The port library.
Returns:
0 on failure, time value in milliseconds on success.
Deprecated:
Use hytime_hires_clock and hytime_hires_delta

void VMCALL hytime_shutdown ( struct HyPortLibrary portLibrary  ) 

PortLibrary shutdown.

This function is called during shutdown of the portLibrary. Any resources that were created by hytime_startup should be destroyed here.

Parameters:
[in] portLibrary The port library.
Note:
Most implementations will be empty.

I_32 VMCALL hytime_startup ( struct HyPortLibrary portLibrary  ) 

PortLibrary startup.

This function is called during startup of the portLibrary. Any resources that are required for the time operations may be created here. All resources created here should be destroyed in hytime_shutdown.

Parameters:
[in] portLibrary The port library.
Returns:
0 on success, negative error code on failure. Error code values returned are
  • HYPORT_ERROR_STARTUP_TIME
Note:
Most implementations will simply return success.

UDATA VMCALL hytime_usec_clock ( struct HyPortLibrary portLibrary  ) 

Query OS for timestamp.

Retrieve the current value of system clock and convert to microseconds.

Parameters:
[in] portLibrary The port library.
Returns:
0 on failure, time value in microseconds on success.
Deprecated:
Use hytime_hires_clock and hytime_hires_delta


Genereated on Tue Dec 9 14:12:59 2008 by Doxygen.

(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.