Platform |
Operating System |
Compiler |
Notes |
---|---|---|---|
ix86 |
SuSE
9.2 |
GNU
G++ 3.3.4 |
binary RPM available |
SuSE 9.0 |
Intel ICC 8.0 |
last test was prior to RLog 1.3.4 |
|
RedHat
7.3 |
GNU
G++ 2.96 |
binary RPM available | |
OpenBSD
3.4 |
GNU
G++ 2.95.3 |
Tested with 1.3.5 |
|
FreeBSD
4.10-beta |
GNU
G++ 2.95.4 |
Support added in 1.3.6 release |
|
sparc |
Solaris
5.9 |
GNU
G++ 3.3.2 |
|
PowerPC |
Darwin
5.5 |
gcc-932.1 |
Support added in 1.3.6 release |
00001 /***************************************************************************** 00002 * Author: Vadim Zeitlin <vadim@wxwidgets.org> 00003 * 00004 ***************************************************************************** 00005 * Copyright (c) 2004 Vadim Zeitlin 00006 * 00007 * This library is free software; you can distribute it and/or modify it under 00008 * the terms of the GNU Lesser General Public License (LGPL), as published by 00009 * the Free Software Foundation; either version 2.1 of the License, or (at your 00010 * option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, but WITHOUT 00013 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 * FITNESS FOR A PARTICULAR PURPOSE. See the LGPL in the file COPYING for more 00015 * details. 00016 * 00017 */ 00018 00019 #ifndef _rlog_time_incl 00020 #define _rlog_time_incl 00021 00022 #include <rlog/common.h> 00023 00028 #ifdef _WIN32 00029 00030 #include <windows.h> 00031 00032 #define HAVE_QUERYPERFORMANCECOUNTER 1 00033 00034 typedef __int64 rlog_time_interval; 00035 00036 #if HAVE_QUERYPERFORMANCECOUNTER 00037 00038 typedef LARGE_INTEGER rlog_time; 00039 00040 #define RLOG_TIME_UNIT "clock cycles" 00041 00042 inline 00043 void rlog_get_time(rlog_time *pt) 00044 { 00045 QueryPerformanceCounter(pt); 00046 } 00047 00048 inline 00049 rlog_time_interval rlog_time_diff(const rlog_time& end, const rlog_time& start) 00050 { 00051 long long llEnd, llStart; 00052 memcpy(&llEnd, &end, sizeof(long long)); 00053 memcpy(&llStart, &start, sizeof(long long)); 00054 return llEnd - llStart; 00055 } 00056 00057 #else // !HAVE_QUERYPERFORMANCECOUNTER 00058 00059 typedef FILETIME rlog_time; 00060 00061 #define RLOG_TIME_UNIT "usec" 00062 00063 inline 00064 void rlog_get_time(rlog_time *pt) 00065 { 00066 GetSystemTimeAsFileTime(pt); 00067 } 00068 00069 inline 00070 rlog_time_interval rlog_time_diff(const rlog_time& end, const rlog_time& start) 00071 { 00072 ULONGLONG ullEnd, ullStart; 00073 memcpy(&ullEnd, &end, sizeof(ULONGLONG)); 00074 memcpy(&ullStart, &start, sizeof(ULONGLONG)); 00075 return 10*(ullEnd - ullStart); 00076 } 00077 00078 #endif // HAVE_QUERYPERFORMANCECOUNTER 00079 00080 inline 00081 void sleep(int seconds) 00082 { 00083 ::Sleep(seconds * 1000); 00084 } 00085 00086 #else // Unix 00087 00088 #include <sys/time.h> 00089 #include <unistd.h> // for sleep() 00090 00091 #if RLOG_TIME_TSC 00092 00093 #include <stdint.h> 00094 00095 typedef uint64_t rlog_time; 00096 typedef int64_t rlog_time_interval; 00097 00098 #define RLOG_TIME_UNIT "clock cycles" 00099 00100 inline void rlog_get_time(uint64_t *pt) 00101 { 00102 asm volatile("RDTSC" : "=A" (*pt)); 00103 } 00104 00105 inline 00106 rlog_time_interval rlog_time_diff( const rlog_time &end, const rlog_time &start ) 00107 { 00108 return end - start; 00109 } 00110 00111 #else // !HAVE_TSC 00112 00113 #include <unistd.h> 00114 00115 typedef timeval rlog_time; 00116 typedef long rlog_time_interval; 00117 00118 #define RLOG_TIME_UNIT "usec" 00119 00120 inline 00121 void rlog_get_time(rlog_time *pt) 00122 { 00123 gettimeofday( pt, 0 ); 00124 } 00125 00126 inline 00127 rlog_time_interval rlog_time_diff( const rlog_time &end, const rlog_time &start ) 00128 { 00129 return (end.tv_sec - start.tv_sec) * 1000 * 1000 + 00130 (end.tv_usec - start.tv_usec); 00131 } 00132 00133 #endif // HAVE_TSC/!HAVE_TSC 00134 00135 #endif // Win32/Unix 00136 00137 #endif // _rlog_time_incl
addPublisher(RLogNode *) | rlog::RLogNode | [virtual] |
addSubscriber(RLogNode *) | rlog::RLogNode | [virtual] |
clear() | rlog::RLogNode | [virtual] |
colorize (defined in rlog::StdioNode) | rlog::StdioNode | [protected] |
DefaultOutput enum value (defined in rlog::StdioNode) | rlog::StdioNode | |
dropPublisher(RLogNode *, bool callbacks=true) | rlog::RLogNode | [virtual] |
dropSubscriber(RLogNode *) | rlog::RLogNode | [virtual] |
enabled() const | rlog::RLogNode | |
fdOut (defined in rlog::StdioNode) | rlog::StdioNode | [protected] |
interestList | rlog::RLogNode | [protected] |
isInterested(RLogNode *node, bool isInterested) | rlog::RLogNode | [virtual] |
mutex (defined in rlog::RLogNode) | rlog::RLogNode | [protected] |
operator=(const StdioNode &) (defined in rlog::StdioNode) | rlog::StdioNode | [protected] |
outputChannel (defined in rlog::StdioNode) | rlog::StdioNode | [protected] |
OutputChannel enum value (defined in rlog::StdioNode) | rlog::StdioNode | |
OutputColor enum value (defined in rlog::StdioNode) | rlog::StdioNode | |
OutputContext enum value (defined in rlog::StdioNode) | rlog::StdioNode | |
outputContext (defined in rlog::StdioNode) | rlog::StdioNode | [protected] |
OutputThreadId enum value (defined in rlog::StdioNode) | rlog::StdioNode | |
outputThreadId (defined in rlog::StdioNode) | rlog::StdioNode | [protected] |
publish(const RLogData &data) | rlog::StdioNode | [protected, virtual] |
publishers | rlog::RLogNode | [protected] |
RLogNode() | rlog::RLogNode | |
setEnabled(bool newState) | rlog::RLogNode | [protected, virtual] |
StdioFlags enum name (defined in rlog::StdioNode) | rlog::StdioNode | |
StdioNode(int fdOut=2, int flags=(int) DefaultOutput) | rlog::StdioNode | |
StdioNode(int fdOut, bool colorize_if_tty) (defined in rlog::StdioNode) | rlog::StdioNode | |
StdioNode(const StdioNode &) (defined in rlog::StdioNode) | rlog::StdioNode | [protected] |
subscribers | rlog::RLogNode | [protected] |
subscribeTo(RLogNode *node) | rlog::StdioNode | |
~RLogNode() | rlog::RLogNode | [virtual] |
~StdioNode() (defined in rlog::StdioNode) | rlog::StdioNode | [virtual] |
#include <rlog/rloginit.h>
Public Member Functions | |
virtual void | init (int &argv, char **argc) |
virtual const char * | moduleName () const=0 |
Related Functions | |
(Note that these are not member functions.) | |
RLogModule * | RegisterModule (RLogModule *module) |
Currently this only allows for initialization callbacks. When RLogInit() is called, init() is called on all modules which have been registered.
void RLogModule::init | ( | int & | argv, | |
char ** | argc | |||
) | [virtual] |
Called by RLogInit() to give the modules the command-line arguments
virtual const char* rlog::RLogModule::moduleName | ( | ) | const [pure virtual] |
Must be implemented to return the name of the module.
RLogModule * RegisterModule | ( | RLogModule * | module | ) | [related] |
Registers the module - which will have init() called when RLogInit is called. Returns the module so that it can be used easily as a static initializer.
class MyModule : public rlog::RLogModule { public: virtual const char *moduleName() const {return "MyModule";} }; static RLogModule * testModule = rlog::RegisterModule( new MyModule() );