Skip to content

Commit

Permalink
added full fledged vampirtrace support
Browse files Browse the repository at this point in the history
  • Loading branch information
hydroo committed Aug 27, 2009
1 parent b3ac0d7 commit e5062da
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 0 deletions.
29 changes: 29 additions & 0 deletions enable-vampirtrace.pri
@@ -0,0 +1,29 @@
# videocapture is tool with no special purpose
#
# Copyright (C) 2009 Ronny Brendel <ronnybrendel@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>


DEFINES += HAVE_VAMPIRTRACE

QMAKE_CXX=vtcxx
QMAKE_CXXFLAGS += -vt:cxx g++-4.4 -vt:inst manual -DVTRACE

QMAKE_CC=vtcc
QMAKE_CFLAGS += -vt:cc gcc-4.4 -vt:inst manual -DVTRACE

QMAKE_LINK = vtcxx
QMAKE_LFLAGS += -vt:cxx g++-4.4 -vt:inst manual -DVTRACE

39 changes: 39 additions & 0 deletions src/Prereqs.hpp
Expand Up @@ -20,6 +20,45 @@
#define PREREQS_HPP


/* more to come */


#ifdef HAVE_VAMPIRTRACE

#include <vt_user.h>

/** write a trace record at his point and the destructor call/block end
@note needs HAVE_VAMPIRTRACE to be defined */
#define VTN(name) VT_TRACER(name);
/** write an enter record - "trace start"
@note needs HAVE_VAMPIRTRACE to be defined
@ingroup prereqs */
#define VTN_START(name) VT_USER_START(name)
/** write a leave record - "trace end"
@note needs HAVE_VAMPIRTRACE to be defined */
#define VTN_END(name) VT_USER_END(name)

/** trace this function - from this point to desctructor call/block end
@note needs HAVE_VAMPIRTRACE to be defined */
#define VT VTN(__func__)
/** trace this function - start
@note needs HAVE_VAMPIRTRACE to be defined */
#define VT_START VTN_START(__func__)
/** trace this function - end
@note needs HAVE_VAMPIRTRACE to be defined */
#define VT_END VTN_END(__func__)

#else /* HAVE_VAMPIRTRACE */

#define VTN(name)
#define VTN_START(name)
#define VTN_END(name)

#define VT
#define VT_START
#define VT_END

#endif /* HAVE_VAMPIRTRACE */


#endif /* PREREQS_HPP */
Expand Down
2 changes: 2 additions & 0 deletions src/main.cpp
Expand Up @@ -32,6 +32,8 @@ using namespace std;

int main(int argc, char **args)
{
VT

QApplication app(argc, args);


Expand Down
2 changes: 2 additions & 0 deletions videocapture.pro
Expand Up @@ -50,3 +50,5 @@ SOURCES += ./src/CaptureDevice.cpp \
./src/main.cpp \
./src/MainWindow.cpp

#include(enable-vampirtrace.pri)

8 changes: 8 additions & 0 deletions videocapture.vampirtrace.sh
@@ -0,0 +1,8 @@
#! /bin/bash

# no flush limit
# manual demangling
# unique prefix for easier deletion
# bigger buffer for fewer flushes
VT_MAX_FLUSHES=0 VT_GNU_DEMANGLE=yes VT_FILE_PREFIX=vt_videocapture VT_BUFFER_SIZE=1024M VT_PFORM_GDIR=./ VT_PFORM_LDIR=/tmp/ ./videocapture

0 comments on commit e5062da

Please sign in to comment.