Qtopia library API Documentation

qpedebug.cpp

00001 /**********************************************************************
00002 ** Copyright (C) 2000-2002 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of the Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
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 
KDE Logo
This file is part of the documentation for OPIE Version 1.5.5.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:24:07 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001