/usr/include/kprofilemethod.h is in kdesdk-misc 4:4.13.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | /* This file is part of the KDE project
Copyright (C) 2002 David Faure <faure@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KPROFILEMETHOD_H
#define KPROFILEMETHOD_H
#include <QtCore/QDateTime>
#include <kdebug.h>
/**
* Those macros help profiling using QTime.
* They allow to sum up the time taken by a given bit of code
* in a method called several times.
* This way one can find out which low-level method used by a high-level
* method is taking most of its time
*
*
* Declare the var somewhere, out of any method:
* int pr_theMethod = 0;
* (the name pr_* helps finding and removing all of this before committing)
*
* Then in the method, around the code to be timed:
* PROFILE_METHOD_BEGIN( pr_theMethod );
* ...
* PROFILE_METHOD_END( pr_theMethod );
*
* And finally, to see the result, put this call in a method
* called after all that (destructor, program exit...)
* PROFILE_METHOD_PRINT( pr_theMethod, "theMethod" );
*
*/
#define PROFILE_METHOD_BEGIN(sym) extern int sym; QTime profile_dt##sym; profile_dt##sym.start();
#define PROFILE_METHOD_END(sym) extern int sym; sym += profile_dt##sym.elapsed();
#define PROFILE_METHOD_PRINT(sym, name) extern int sym; kDebug() << name << " took " << sym << " milliseconds" << endl;
#endif // KPROFILEMETHOD_H
|