escript  Revision_
performance.h
Go to the documentation of this file.
00001 
00002 /*****************************************************************************
00003 *
00004 * Copyright (c) 2003-2014 by University of Queensland
00005 * http://www.uq.edu.au
00006 *
00007 * Primary Business: Queensland, Australia
00008 * Licensed under the Open Software License version 3.0
00009 * http://www.opensource.org/licenses/osl-3.0.php
00010 *
00011 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
00012 * Development 2012-2013 by School of Earth Sciences
00013 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
00014 *
00015 *****************************************************************************/
00016 
00017 
00018 /****************************************************************************/
00019 
00020 /* Paso: perfomance monitor interface using PAPI                            */
00021 
00022 /****************************************************************************/
00023 
00024 /* Copyrights by ACcESS Australia 2006 */
00025 /* Author: Lutz Gross, l.gross@uq.edu.au */
00026 
00027 /****************************************************************************/
00028 
00029 #ifndef __PASO_PERFORMANCE_H__
00030 #define __PASO_PERFORMANCE_H__
00031 
00032 #ifdef PAPI
00033 #include <papi.h>
00034 #endif
00035 
00036 namespace paso {
00037 
00038 #define PERFORMANCE_UNMONITORED_EVENT -1
00039 #define PERFORMANCE_NUM_EVENTS 10 // maximum number of events handled by PAPI
00040 
00041 #define PERFORMANCE_ALL 0
00042 #define PERFORMANCE_SOLVER 1
00043 #define PERFORMANCE_PRECONDITIONER_INIT 2
00044 #define PERFORMANCE_PRECONDITIONER 3
00045 #define PERFORMANCE_MVM 4
00046 #define PERFORMANCE_ASSEMBLAGE 5
00047 #define PERFORMANCE_UNKNOWN 6  // more can be added here
00048 #define PERFORMANCE_NUM_MONITORS PERFORMANCE_UNKNOWN+1
00049 
00050 #define PERFORMANCE_UNUSED -1
00051 #define PERFORMANCE_CLOSED 0
00052 #define PERFORMANCE_OPENED 1
00053 
00054 struct Performance
00055 {
00056 #ifdef PAPI
00057 
00058     int event_set;
00060     int num_events;
00062     int events[PERFORMANCE_NUM_EVENTS];
00064     long_long values[PERFORMANCE_NUM_MONITORS][PERFORMANCE_NUM_EVENTS];
00066     long_long cycles[PERFORMANCE_NUM_MONITORS];
00067     int set[PERFORMANCE_NUM_MONITORS];
00068 #else
00069     int dummy;
00070 #endif
00071 };
00072 
00073 void Performance_open(Performance* pp, int verbose);
00074 int  Performance_getEventIndex(Performance* pp, int event_id);
00075 void Performance_close(Performance* pp, int verbose);
00076 void Performance_startMonitor(Performance* pp, int monitor);
00077 void Performance_stopMonitor(Performance* pp, int monitor);
00078 
00079 } // namespace paso
00080 
00081 #endif // __PASO_PERFORMANCE_H__
00082