Sync with trunk r63637.
[reactos.git] / dll / win32 / shlwapi / stopwatch.c
1 /*
2 * Stopwatch Functions
3 *
4 * Copyright 2004 Jon Griffiths
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 *
20 * NOTES
21 * These functions probably never need to be implemented unless we
22 * A) Rewrite explorer from scratch, and
23 * B) Want to use a substandard API to tune its performance.
24 */
25
26 #include "precomp.h"
27
28 /*************************************************************************
29 * @ [SHLWAPI.241]
30 *
31 * Get the current performance monitoring mode.
32 *
33 * PARAMS
34 * None.
35 *
36 * RETURNS
37 * The current performance monitoring mode. This is zero if monitoring
38 * is disabled (the default).
39 *
40 * NOTES
41 * If this function returns 0, no further StopWatch functions should be called.
42 */
43 DWORD WINAPI StopWatchMode(void)
44 {
45 FIXME("() stub!\n");
46 return 0;
47 }
48
49 /*************************************************************************
50 * @ [SHLWAPI.242]
51 *
52 * Write captured performance nodes to a log file.
53 *
54 * PARAMS
55 * None.
56 *
57 * RETURNS
58 * Nothing.
59 */
60 void WINAPI StopWatchFlush(void)
61 {
62 FIXME("() stub!\n");
63 }
64
65 /*************************************************************************
66 * @ [SHLWAPI.244]
67 *
68 * Write a performance event to a log file
69 *
70 * PARAMS
71 * dwClass [I] Class of event
72 * lpszStr [I] Text of event to log
73 * dwUnknown [I] Unknown
74 * dwMode [I] Mode flags
75 * dwTimeStamp [I] Timestamp
76 *
77 * RETURNS
78 * Success: ERROR_SUCCESS.
79 * Failure: A standard Win32 error code indicating the failure.
80 */
81 DWORD WINAPI StopWatchW(DWORD dwClass, LPCWSTR lpszStr, DWORD dwUnknown,
82 DWORD dwMode, DWORD dwTimeStamp)
83 {
84 FIXME("(%d,%s,%d,%d,%d) stub!\n", dwClass, debugstr_w(lpszStr),
85 dwUnknown, dwMode, dwTimeStamp);
86 return ERROR_SUCCESS;
87 }
88
89 /*************************************************************************
90 * @ [SHLWAPI.243]
91 *
92 * See StopWatchW.
93 */
94 DWORD WINAPI StopWatchA(DWORD dwClass, LPCSTR lpszStr, DWORD dwUnknown,
95 DWORD dwMode, DWORD dwTimeStamp)
96 { DWORD retval;
97 UNICODE_STRING szStrW;
98
99 if(lpszStr) RtlCreateUnicodeStringFromAsciiz(&szStrW, lpszStr);
100 else szStrW.Buffer = NULL;
101
102 retval = StopWatchW(dwClass, szStrW.Buffer, dwUnknown, dwMode, dwTimeStamp);
103
104 RtlFreeUnicodeString(&szStrW);
105 return retval;
106 }
107
108 /*************************************************************************
109 * @ [SHLWAPI.245]
110 *
111 * Log a shell frame event.
112 *
113 * PARAMS
114 * hWnd [I] Window having the event
115 * pvUnknown1 [I] Unknown
116 * bUnknown2 [I] Unknown
117 * pClassWnd [I] Window of class to log
118 *
119 * RETURNS
120 * Nothing.
121 */
122 void WINAPI StopWatch_TimerHandler(HWND hWnd, PVOID pvUnknown1, BOOL bUnknown2, HWND *pClassWnd)
123 {
124 FIXME("(%p,%p,%d,%p) stub!\n", hWnd, pvUnknown1, bUnknown2 ,pClassWnd);
125 }
126
127 /* FIXME: Parameters for @246:StopWatch_CheckMsg unknown */
128
129 /*************************************************************************
130 * @ [SHLWAPI.247]
131 *
132 * Log the start of an applet.
133 *
134 * PARAMS
135 * lpszName [I] Name of the applet
136 *
137 * RETURNS
138 * Nothing.
139 */
140 void WINAPI StopWatch_MarkFrameStart(LPCSTR lpszName)
141 {
142 FIXME("(%s) stub!\n", debugstr_a(lpszName));
143 }
144
145 /* FIXME: Parameters for @248:StopWatch_MarkSameFrameStart unknown */
146
147 /*************************************************************************
148 * @ [SHLWAPI.249]
149 *
150 * Log a java applet stopping.
151 *
152 * PARAMS
153 * lpszEvent [I] Name of the event (applet)
154 * hWnd [I] Window running the applet
155 * dwReserved [I] Unused
156 *
157 * RETURNS
158 * Nothing.
159 */
160 void WINAPI StopWatch_MarkJavaStop(LPCWSTR lpszEvent, HWND hWnd, DWORD dwReserved)
161 {
162 FIXME("(%s,%p,0x%08x) stub!\n", debugstr_w(lpszEvent), hWnd, dwReserved);
163 }
164
165 /*************************************************************************
166 * @ [SHLWAPI.250]
167 *
168 * Read the performance counter.
169 *
170 * PARAMS
171 * None.
172 *
173 * RETURNS
174 * The low 32 bits of the current performance counter reading.
175 */
176 DWORD WINAPI GetPerfTime(void)
177 {
178 static LONG64 iCounterFreq = 0;
179 LARGE_INTEGER iCounter;
180
181 TRACE("()\n");
182
183 if (!iCounterFreq)
184 QueryPerformanceFrequency((LARGE_INTEGER*)&iCounterFreq);
185
186 QueryPerformanceCounter(&iCounter);
187 iCounter.QuadPart = iCounter.QuadPart * 1000 / iCounterFreq;
188 return iCounter.u.LowPart;
189 }
190
191 /* FIXME: Parameters for @251:StopWatch_DispatchTime unknown */
192
193 /*************************************************************************
194 * @ [SHLWAPI.252]
195 *
196 * Set an as yet unidentified performance value.
197 *
198 * PARAMS
199 * dwUnknown [I] Value to set
200 *
201 * RETURNS
202 * dwUnknown.
203 */
204 DWORD WINAPI StopWatch_SetMsgLastLocation(DWORD dwUnknown)
205 {
206 FIXME("(%d) stub!\n", dwUnknown);
207
208 return dwUnknown;
209 }
210
211 /* FIXME: Parameters for @253:StopWatchExA, 254:StopWatchExW unknown */