Changeset 13680 in webkit for trunk/JavaScriptCore/kjs/testkjs.cpp
- Timestamp:
- Apr 4, 2006, 5:11:08 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/testkjs.cpp
r13211 r13680 3 3 * This file is part of the KDE libraries 4 4 * Copyright (C) 1999-2000 Harri Porten ([email protected]) 5 * Copyright (C) 2004 Apple Computer, Inc. 5 * Copyright (C) 2004-2006 Apple Computer, Inc. 6 * Copyright (C) 2006 Björn Graf ([email protected]) 6 7 * 7 8 * This library is free software; you can redistribute it and/or … … 39 40 #endif 40 41 42 #if PLATFORM(WIN_OS) 43 #include <windows.h> 44 #endif 45 41 46 using namespace KJS; 42 47 using namespace KXMLCore; … … 53 58 54 59 private: 55 #if !PLATFORM(WIN_OS) 60 #if PLATFORM(WIN_OS) 61 DWORD m_startTime; 62 DWORD m_stopTime; 63 #else 56 64 // Windows does not have timeval, disabling this class for now (bug 7399) 57 65 timeval m_startTime; … … 62 70 void StopWatch::start() 63 71 { 64 #if !PLATFORM(WIN_OS) 72 #if PLATFORM(WIN_OS) 73 m_startTime = timeGetTime(); 74 #else 65 75 gettimeofday(&m_startTime, 0); 66 76 #endif … … 69 79 void StopWatch::stop() 70 80 { 71 #if !PLATFORM(WIN_OS) 81 #if PLATFORM(WIN_OS) 82 m_stopTime = timeGetTime(); 83 #else 72 84 gettimeofday(&m_stopTime, 0); 73 85 #endif … … 76 88 long StopWatch::getElapsedMS() 77 89 { 78 #if !PLATFORM(WIN_OS) 90 #if PLATFORM(WIN_OS) 91 return m_stopTime - m_startTime; 92 #else 79 93 timeval elapsedTime; 80 94 timersub(&m_stopTime, &m_startTime, &elapsedTime); 81 95 82 96 return elapsedTime.tv_sec * 1000 + lroundf(elapsedTime.tv_usec / 1000.0); 83 #else84 return 0;85 97 #endif 86 98 } … … 152 164 } 153 165 166 #if PLATFORM(WIN_OS) 167 168 // Use SEH for Release builds only to get rid of the crash report dialog 169 // (luckyly the same tests fail in Release and Debug builds so far). Need to 170 // be in a separate main function because the kjsmain function requires object 171 // unwinding. 172 173 #if defined(_DEBUG) 174 #define TRY 175 #define EXCEPT(x) 176 #else 177 #define TRY __try { 178 #define EXCEPT(x) } __except (EXCEPTION_EXECUTE_HANDLER) { x; } 179 #endif 180 181 #else 182 183 #define TRY 184 #define EXCEPT(x) 185 186 #endif 187 188 int kjsmain(int argc, char** argv); 189 154 190 int main(int argc, char** argv) 191 { 192 int res = 0; 193 TRY 194 res = kjsmain(argc, argv); 195 EXCEPT(res = 3) 196 return res; 197 } 198 199 int kjsmain(int argc, char** argv) 155 200 { 156 201 if (argc < 2) {
Note:
See TracChangeset
for help on using the changeset viewer.