stopwatch.c 5.57 KB
Newer Older
Jon Griffiths's avatar
Jon Griffiths committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/*
 * Stopwatch Functions
 *
 * Copyright 2004 Jon Griffiths
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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
Jon Griffiths's avatar
Jon Griffiths committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
 *
 * NOTES
 * These functions probably never need to be implemented unless we
 * A) Rewrite explorer from scratch, and
 * B) Want to use a substandard API to tune its performance.
 */

#include "config.h"
#include "wine/port.h"

#include <stdarg.h>
#include <string.h>
#include <stdlib.h>

#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
38
#include "winternl.h"
Jon Griffiths's avatar
Jon Griffiths committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
#include "wine/debug.h"

WINE_DEFAULT_DEBUG_CHANNEL(shell);

/*************************************************************************
 *      @	[SHLWAPI.241]
 *
 * Get the current performance monitoring mode.
 *
 * PARAMS
 *  None.
 *
 * RETURNS
 *  The current performance monitoring mode. This is zero if monitoring
 *  is disabled (the default).
 *
 * NOTES
 *  If this function returns 0, no further StopWatch functions should be called.
 */
58
DWORD WINAPI StopWatchMode(void)
Jon Griffiths's avatar
Jon Griffiths committed
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
{
  FIXME("() stub!\n");
  return 0;
}

/*************************************************************************
 *      @	[SHLWAPI.242]
 *
 * Write captured performance nodes to a log file.
 *
 * PARAMS
 *  None.
 *
 * RETURNS
 *  Nothing.
 */
75
void WINAPI StopWatchFlush(void)
Jon Griffiths's avatar
Jon Griffiths committed
76 77 78 79 80
{
  FIXME("() stub!\n");
}

/*************************************************************************
81
 *      @	[SHLWAPI.244]
Jon Griffiths's avatar
Jon Griffiths committed
82 83 84 85 86 87 88 89 90 91 92 93 94 95
 *
 * Write a performance event to a log file
 *
 * PARAMS
 *  dwClass     [I] Class of event
 *  lpszStr     [I] Text of event to log
 *  dwUnknown   [I] Unknown
 *  dwMode      [I] Mode flags
 *  dwTimeStamp [I] Timestamp
 *
 * RETURNS
 *  Success: ERROR_SUCCESS.
 *  Failure: A standard Win32 error code indicating the failure.
 */
96
DWORD WINAPI StopWatchW(DWORD dwClass, LPCWSTR lpszStr, DWORD dwUnknown,
Jon Griffiths's avatar
Jon Griffiths committed
97 98
                        DWORD dwMode, DWORD dwTimeStamp)
{
99
    FIXME("(%d,%s,%d,%d,%d) stub!\n", dwClass, debugstr_w(lpszStr),
Jon Griffiths's avatar
Jon Griffiths committed
100 101 102 103 104
        dwUnknown, dwMode, dwTimeStamp);
  return ERROR_SUCCESS;
}

/*************************************************************************
105
 *      @	[SHLWAPI.243]
Jon Griffiths's avatar
Jon Griffiths committed
106
 *
107
 * See StopWatchW.
Jon Griffiths's avatar
Jon Griffiths committed
108
 */
109
DWORD WINAPI StopWatchA(DWORD dwClass, LPCSTR lpszStr, DWORD dwUnknown,
Jon Griffiths's avatar
Jon Griffiths committed
110
                        DWORD dwMode, DWORD dwTimeStamp)
111 112 113 114 115
{   DWORD retval;
    UNICODE_STRING szStrW;

    if(lpszStr) RtlCreateUnicodeStringFromAsciiz(&szStrW, lpszStr);
    else szStrW.Buffer = NULL;
Jon Griffiths's avatar
Jon Griffiths committed
116

117
    retval = StopWatchW(dwClass, szStrW.Buffer, dwUnknown, dwMode, dwTimeStamp);
Jon Griffiths's avatar
Jon Griffiths committed
118

119 120
    RtlFreeUnicodeString(&szStrW);
    return retval;
Jon Griffiths's avatar
Jon Griffiths committed
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
}

/*************************************************************************
 *      @	[SHLWAPI.245]
 *
 * Log a shell frame event.
 *
 * PARAMS
 *  hWnd       [I] Window having the event
 *  pvUnknown1 [I] Unknown
 *  bUnknown2  [I] Unknown
 *  pClassWnd  [I] Window of class to log
 *
 * RETURNS
 *  Nothing.
 */
void WINAPI StopWatch_TimerHandler(HWND hWnd, PVOID pvUnknown1, BOOL bUnknown2, HWND *pClassWnd)
{
  FIXME("(%p,%p,%d,%p) stub!\n", hWnd, pvUnknown1, bUnknown2 ,pClassWnd);
}

/* FIXME: Parameters for @246:StopWatch_CheckMsg unknown */

/*************************************************************************
 *      @	[SHLWAPI.247]
 *
 * Log the start of an applet.
 *
 * PARAMS
 *  lpszName [I] Name of the applet
 *
 * RETURNS
 *  Nothing.
 */
void WINAPI StopWatch_MarkFrameStart(LPCSTR lpszName)
{
  FIXME("(%s) stub!\n", debugstr_a(lpszName));
}

/* FIXME: Parameters for @248:StopWatch_MarkSameFrameStart unknown */

/*************************************************************************
 *      @	[SHLWAPI.249]
 *
 * Log a java applet stopping.
 *
 * PARAMS
 *  lpszEvent  [I] Name of the event (applet)
 *  hWnd       [I] Window running the applet
 *  dwReserved [I] Unused
 *
 * RETURNS
 *  Nothing.
 */
void WINAPI StopWatch_MarkJavaStop(LPCWSTR lpszEvent, HWND hWnd, DWORD dwReserved)
{
177
  FIXME("(%s,%p,0x%08x) stub!\n", debugstr_w(lpszEvent), hWnd, dwReserved);
Jon Griffiths's avatar
Jon Griffiths committed
178 179 180 181 182 183 184 185 186 187 188 189 190
}

/*************************************************************************
 *      @	[SHLWAPI.250]
 *
 * Read the performance counter.
 *
 * PARAMS
 *  None.
 *
 * RETURNS
 *  The low 32 bits of the current performance counter reading.
 */
191
DWORD WINAPI GetPerfTime(void)
Jon Griffiths's avatar
Jon Griffiths committed
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
{
  static LONG64 iCounterFreq = 0;
  LARGE_INTEGER iCounter;

  TRACE("()\n");

  if (!iCounterFreq)
   QueryPerformanceFrequency((LARGE_INTEGER*)&iCounterFreq);

  QueryPerformanceCounter(&iCounter);
  iCounter.QuadPart = iCounter.QuadPart * 1000 / iCounterFreq;
  return iCounter.u.LowPart;
}

/* FIXME: Parameters for @251:StopWatch_DispatchTime unknown */

/*************************************************************************
 *      @	[SHLWAPI.252]
 *
 * Set an as yet unidentified performance value.
 *
 * PARAMS
 *  dwUnknown [I] Value to set
 *
 * RETURNS
 *  dwUnknown.
 */
DWORD WINAPI StopWatch_SetMsgLastLocation(DWORD dwUnknown)
{
221
  FIXME("(%d) stub!\n", dwUnknown);
Jon Griffiths's avatar
Jon Griffiths committed
222 223 224 225 226

  return dwUnknown;
}

/* FIXME: Parameters for @253:StopWatchExA, 254:StopWatchExW unknown */