Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

236 lines
5.2 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. idlrpc.idl
  5. Abstract:
  6. Contains the RPC interface specification for the idle task / idle detection APIs.
  7. Also contains the RPC specific data structures for these API.
  8. Author:
  9. Cenk Ergan (cenke) 07-August-2000
  10. Environment:
  11. User Mode - Win32 - MIDL
  12. Revision History:
  13. --*/
  14. //
  15. // Interface Attributes
  16. //
  17. [
  18. uuid(0a74ef1c-41a4-4e06-83ae-dc74fb1cdd53),
  19. version(1.0)
  20. ]
  21. //
  22. // Interface Keyword
  23. //
  24. interface idletask
  25. //
  26. // Interface Body
  27. //
  28. {
  29. import "wtypes.idl";
  30. //
  31. // IT_IDLE_TASK_ID declaration.
  32. //
  33. #define MIDL_PASS
  34. #include <idletask.h>
  35. //
  36. // The prefered protocol sequence for connecting the server and the
  37. // client is LPC because of its low overhead. We'd like to bind to
  38. // dynamic endpoint, because a well known endpoint may require another
  39. // listener thread on the server side. Note that depending on the
  40. // other RPC servers in the process we end up in, other bindings may
  41. // also be used.
  42. //
  43. const WCHAR * IT_RPC_PROTSEQ = L"ncalrpc";
  44. //
  45. // This is the custom binding handle type. Specifying this allows us
  46. // to bind to the server when the interface functions are called via
  47. // the IT_RPC_bind and _unbind functions that are part of the client.
  48. // It is not used for any other purpose, although it has to be a
  49. // parameter to the interface functions.
  50. //
  51. typedef [handle] WCHAR * ITRPC_HANDLE;
  52. //
  53. // This is a custom context handle. This allows the server to get
  54. // notified when a client dies.
  55. //
  56. typedef [context_handle] VOID *IT_HANDLE;
  57. //
  58. // Status of an idle task.
  59. //
  60. typedef enum _IT_IDLE_TASK_STATUS {
  61. ItIdleTaskInitializing,
  62. ItIdleTaskQueued,
  63. ItIdleTaskRunning,
  64. ItIdleTaskMaxStatus
  65. } IT_IDLE_TASK_STATUS, *PIT_IDLE_TASK_STATUS;
  66. //
  67. // This structure describes the idle task the client wants to register.
  68. //
  69. typedef struct _IT_IDLE_TASK_PROPERTIES {
  70. //
  71. // Size of the structure.
  72. //
  73. ULONG Size;
  74. //
  75. // Idle task identifier and which process it is in. These two
  76. // uniquely identify the idle task.
  77. //
  78. IT_IDLE_TASK_ID IdleTaskId;
  79. DWORD ProcessId;
  80. //
  81. // Local handle for the event to be notified when the task should
  82. // start running.
  83. //
  84. ULONG_PTR StartEventHandle;
  85. //
  86. // Local handle for the event to be notified when the task should
  87. // stop running.
  88. //
  89. ULONG_PTR StopEventHandle;
  90. } IT_IDLE_TASK_PROPERTIES, *PIT_IDLE_TASK_PROPERTIES;
  91. //
  92. // This structure contains parameters that control the behaviour of
  93. // idle detection.
  94. //
  95. typedef struct _IT_IDLE_DETECTION_PARAMETERS {
  96. //
  97. // This is how long in ms we will wait until each time we check
  98. // for system idleness.
  99. //
  100. ULONG IdleDetectionPeriod;
  101. //
  102. // After we detect that system was idle over a long period, we
  103. // will verify the system is still idle by checking idleness over
  104. // a smaller period. This way we won't miss recent activity that
  105. // seemed insignificant over a long IdleDetectionPeriod.
  106. //
  107. ULONG IdleVerificationPeriod;
  108. ULONG NumVerifications;
  109. //
  110. // We will be polling for user input when running idle tasks every
  111. // this many ms. We want to catch user input and notify the idle task
  112. // to stop running as soon as possible. Even though the system is
  113. // idle, we don't want to create too much overhead which may mislead
  114. // ourself.
  115. //
  116. ULONG IdleInputCheckPeriod;
  117. //
  118. // We check to see if the idle task we asked to run is really running
  119. // (i.e. it is using the disk and CPU) every this many ms. This is our
  120. // mechanism for cleaning up after unregistered/orphaned tasks. This
  121. // should be greater than IdleInputCheckPeriod.
  122. //
  123. ULONG IdleTaskRunningCheckPeriod;
  124. //
  125. // If the CPU is not idle more than this percent over a time interval,
  126. // the system is not considered idle.
  127. //
  128. ULONG MinCpuIdlePercentage;
  129. //
  130. // If a disk is not idle more than this percent over a time interval,
  131. // the system is not considered idle.
  132. //
  133. ULONG MinDiskIdlePercentage;
  134. //
  135. // This is the maximum number of registered idle tasks at one time.
  136. //
  137. ULONG MaxNumRegisteredTasks;
  138. } IT_IDLE_DETECTION_PARAMETERS, *PIT_IDLE_DETECTION_PARAMETERS;
  139. //
  140. // Idle task server registration/unregistration API. These are not
  141. // called from the user directly. They are called by the client side
  142. // implementation of the RegisterIdleTask/UnregisterIdleTask API.
  143. //
  144. DWORD
  145. ItSrvRegisterIdleTask (
  146. [in,string,unique] ITRPC_HANDLE Reserved,
  147. [out,ref] IT_HANDLE *ItHandle,
  148. [in,ref] PIT_IDLE_TASK_PROPERTIES IdleTaskProperties
  149. );
  150. void
  151. ItSrvUnregisterIdleTask (
  152. [in,string,unique] ITRPC_HANDLE Reserved,
  153. [in,out,ref] IT_HANDLE *ItHandle
  154. );
  155. //
  156. // This function is called to process all registered tasks without
  157. // waiting for system to become idle.
  158. //
  159. DWORD
  160. ItSrvProcessIdleTasks (
  161. [in,string,unique] ITRPC_HANDLE Reserved
  162. );
  163. //
  164. // This function is implemented only in the debug builds so test
  165. // applications can set stress parameters. It returns
  166. // ERROR_NOT_IMPLEMENTED on free builds.
  167. //
  168. DWORD
  169. ItSrvSetDetectionParameters (
  170. [in,string,unique] ITRPC_HANDLE Reserved,
  171. [in,ref] PIT_IDLE_DETECTION_PARAMETERS Parameters
  172. );
  173. }