ReactOS  0.4.14-dev-1036-g3c5b10f
profil.c File Reference
#include <hal.h>
#include <debug.h>
Include dependency graph for profil.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

VOID NTAPI HalStopProfileInterrupt (IN KPROFILE_SOURCE ProfileSource)
 
VOID NTAPI HalStartProfileInterrupt (IN KPROFILE_SOURCE ProfileSource)
 
ULONG_PTR NTAPI HalSetProfileInterval (IN ULONG_PTR Interval)
 

Variables

BOOLEAN HalpProfilingStopped = TRUE
 
UCHAR HalpProfileRate = 8
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file profil.c.

Function Documentation

◆ HalSetProfileInterval()

ULONG_PTR NTAPI HalSetProfileInterval ( IN ULONG_PTR  Interval)

Definition at line 87 of file profil.c.

88 {
89  ULONG_PTR CurrentValue, NextValue;
90  UCHAR i;
91 
92  /* Normalize interval. 122100 ns is the smallest supported */
93  Interval &= ~(1 << 31);
94  if (Interval < 1221)
95  Interval = 1221;
96 
97  /* Highest rate value of 15 means 500 ms */
98  CurrentValue = 5000000;
99  for (i = 15; ; i--)
100  {
101  NextValue = (CurrentValue + 1) / 2;
102  if (Interval > CurrentValue - NextValue / 2)
103  break;
104  CurrentValue = NextValue;
105  }
106 
107  /* Interval as needed by RTC */
108  HalpProfileRate = i;
109 
110  /* Reset the */
112  {
114  }
115 
116  return CurrentValue;
117 }
BOOLEAN HalpProfilingStopped
Definition: profil.c:18
UCHAR HalpProfileRate
Definition: profil.c:19
VOID NTAPI HalStartProfileInterrupt(IN KPROFILE_SOURCE ProfileSource)
Definition: profil.c:33
uint32_t ULONG_PTR
Definition: typedefs.h:64
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DWORD Interval
Definition: netstat.c:33
unsigned char UCHAR
Definition: xmlstorage.h:181

◆ HalStartProfileInterrupt()

VOID NTAPI HalStartProfileInterrupt ( IN KPROFILE_SOURCE  ProfileSource)

Definition at line 57 of file profil.c.

58 {
59  UCHAR StatusA, StatusB;
60 
61  UNREFERENCED_PARAMETER(ProfileSource);
62 
64 
65  /* Acquire the CMOS lock */
67 
68  /* Set the interval in Status Register A */
69  StatusA = HalpReadCmos(RTC_REGISTER_A);
70  StatusA = (StatusA & 0xF0) | HalpProfileRate;
71  HalpWriteCmos(RTC_REGISTER_A, StatusA);
72 
73  /* Enable periodic interrupts in Status Register B */
74  StatusB = HalpReadCmos(RTC_REGISTER_B);
75  StatusB = StatusB | RTC_REG_B_PI;
76  HalpWriteCmos(RTC_REGISTER_B, StatusB);
77 
78  /* Release the CMOS lock */
80 }
BOOLEAN HalpProfilingStopped
Definition: profil.c:18
VOID FORCEINLINE HalpWriteCmos(IN UCHAR Reg, IN UCHAR Value)
Definition: cmos.c:35
UCHAR HalpProfileRate
Definition: profil.c:19
#define RTC_REG_B_PI
Definition: halp.h:55
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
VOID NTAPI HalpReleaseCmosSpinLock(VOID)
Definition: spinlock.c:244
UCHAR FORCEINLINE HalpReadCmos(IN UCHAR Reg)
Definition: cmos.c:24
VOID NTAPI HalpAcquireCmosSpinLock(VOID)
Definition: spinlock.c:227
#define RTC_REGISTER_B
Definition: halp.h:17
unsigned char UCHAR
Definition: xmlstorage.h:181
#define RTC_REGISTER_A
Definition: xboxrtc.c:21

◆ HalStopProfileInterrupt()

VOID NTAPI HalStopProfileInterrupt ( IN KPROFILE_SOURCE  ProfileSource)

Definition at line 28 of file profil.c.

29 {
30  UCHAR StatusB;
31 
32  UNREFERENCED_PARAMETER(ProfileSource);
33 
34  /* Acquire the CMOS lock */
36 
37  /* Read Status Register B */
38  StatusB = HalpReadCmos(RTC_REGISTER_B);
39 
40  /* Disable periodic interrupts */
41  StatusB = StatusB & ~RTC_REG_B_PI;
42 
43  /* Write new value into Status Register B */
44  HalpWriteCmos(RTC_REGISTER_B, StatusB);
45 
47 
48  /* Release the CMOS lock */
50 }
BOOLEAN HalpProfilingStopped
Definition: profil.c:18
VOID FORCEINLINE HalpWriteCmos(IN UCHAR Reg, IN UCHAR Value)
Definition: cmos.c:35
#define TRUE
Definition: types.h:120
#define RTC_REG_B_PI
Definition: halp.h:55
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
VOID NTAPI HalpReleaseCmosSpinLock(VOID)
Definition: spinlock.c:244
UCHAR FORCEINLINE HalpReadCmos(IN UCHAR Reg)
Definition: cmos.c:24
VOID NTAPI HalpAcquireCmosSpinLock(VOID)
Definition: spinlock.c:227
#define RTC_REGISTER_B
Definition: halp.h:17
unsigned char UCHAR
Definition: xmlstorage.h:181

Variable Documentation

◆ HalpProfileRate

UCHAR HalpProfileRate = 8

Definition at line 19 of file profil.c.

Referenced by HalSetProfileInterval(), and HalStartProfileInterrupt().

◆ HalpProfilingStopped

BOOLEAN HalpProfilingStopped = TRUE