qpedebug.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "qpedebug.h"
00022 #include <stdio.h>
00023 #include <sys/time.h>
00024 #include <unistd.h>
00025
00026 struct timeval qpe_debuglast;
00027
00028 void qpe_debugTime( const char *file, int line, const char *desc )
00029 {
00030 struct timeval tv;
00031 gettimeofday( &tv, 0 );
00032
00033 int tdiff = tv.tv_usec - qpe_debuglast.tv_usec;
00034 tdiff += (tv.tv_sec - qpe_debuglast.tv_sec) * 1000000;
00035
00036 fprintf( stderr, "%s:%d Time: %ld.%06ld", file, line, tv.tv_sec, tv.tv_usec);
00037
00038 static int pid = getpid();
00039
00040 if ( qpe_debuglast.tv_sec )
00041 fprintf( stderr, " (pid %d delta %dus)", pid, tdiff );
00042
00043 if ( desc )
00044 fprintf( stderr, " (%s)", desc );
00045
00046 fprintf( stderr, "\n" );
00047
00048 qpe_debuglast = tv;
00049 }
00050
00051
This file is part of the documentation for OPIE Version 1.5.5.