#include <errno.h> #include <time.h> #ifndef NONAMESPACE #include <iostream> using namespace std; #else #include <iostream.h> #endif #include <string> #include "pidfunc.h" #ifndef strptime #include "strptime.h" #endif #define DATEFORMAT "%Y/%m/%d %H:%M:%S" int str2time( string str, bool quiet, time_t *pts ) { tm ttm; if( !strptime( str.c_str(), DATEFORMAT, &ttm ) ) { /* * Date string is not in the expected format. */ if( !quiet ) { /* * Caller wants us to complain about errors. */ cout << "strptime(): Invalid date string, expecting "; cout << DATEFORMAT << "\n"; } /* * Return value indicating that an invalid format was encountered. */ return EINVAL; } ttm.tm_isdst = -1; // don't care about Daylight Savings Time *pts = mktime( &ttm ); return 0; } int str2time( string str, time_t *pts ) { /* * Complain about any errors encoutered in str2time(). */ return str2time( str, false, pts ); } void time2str( time_t ts, string *str ) { #define TIMEBUFSIZE 20 tm *pttm; char buf[TIMEBUFSIZE]; pttm = localtime( &ts ); strftime( buf, TIMEBUFSIZE, DATEFORMAT, pttm ); *str = buf; } void time2ODBCstr( time_t ts, string *str ) { #define TIMEBUFSIZE 20 tm *pttm; char buf[TIMEBUFSIZE]; pttm = localtime( &ts ); strftime( buf, TIMEBUFSIZE, "%Y-%m-%d %H:%M:%S", pttm ); *str = buf; } int tscmp( const void *ppidfunc1, const void *ppidfunc2 ) { double diffts; diffts = difftime( ( *( PidFunc ** )ppidfunc1 )->GetStartTS(), ( *( PidFunc ** )ppidfunc2 )->GetStartTS() ); if( diffts < 0 ) return -1; else if( diffts > 0 ) return 1; else return 0; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 5390 | Shawn Hladky |
modified p4loga: added --csv switch to output a coma-separated variable file identifying every command function recorded. No header or summary info is displayed. This file can be loaded in a spreadsheet application or imported into a database for further analysis. added support to identify the ClientProgram name from the log file. At this point, only server logs for a 2005.1 server have been (minimally) tested. |
||
#1 | 5389 | Shawn Hladky | Branching p4loga for modifications | ||
//guest/michael_shields/src/p4loga/timestamp.cc | |||||
#4 | 4630 | Michael Shields |
Throw away garbage in the log resulting from p4d bug 15356. Such garbage will no longer prematurely terminate p4loga. |
||
#3 | 1817 | Michael Shields | Ported p4loga to ntx86. | ||
#2 | 1722 | Michael Shields |
p4loga builds for freebsd4 (play), hpux11 (hell), linux24x86 (duey), and solaris26 (shucks). A bit of porting was required for the hpux11 build (aCC as configured on hell isn't quite up to speed with respect to namespaces). |
||
#1 | 1610 | Michael Shields |
Adding p4d log analyzer concocted by myself. Compiles and executes on Red Hat 6.0, 7.0, and probably a few other operating systems with perhaps a little help. Still needs comments. |