From 51f091b5fc47c35419172962d08bb5f6459d55b4 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Mon, 4 Jul 2011 08:17:46 +0000 Subject: [PATCH] profile data --- Robust/src/Runtime/bamboo/multicoreprofile.c | 31 +++++++++++++++++++ Robust/src/Runtime/bamboo/multicoreprofile.h | 32 ++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 Robust/src/Runtime/bamboo/multicoreprofile.c create mode 100644 Robust/src/Runtime/bamboo/multicoreprofile.h diff --git a/Robust/src/Runtime/bamboo/multicoreprofile.c b/Robust/src/Runtime/bamboo/multicoreprofile.c new file mode 100644 index 00000000..f8306c2c --- /dev/null +++ b/Robust/src/Runtime/bamboo/multicoreprofile.c @@ -0,0 +1,31 @@ +#include "multicoreprofile.h" +#include "runtime_arch.h" + +struct profiledata * eventdata; + +void startEvent(enum eventprofile event) { + struct eventprofile *profile=&eventdata->cores[BAMBOO_NUM_OF_CORE].events[event]; + profile->totaltimestarts+=BAMBOO_GET_EXE_TIME(); + profile->numstarts++; +} + +void stopEvent(enum eventprofile event) { + struct eventprofile *profile=&eventdata->cores[BAMBOO_NUM_OF_CORE].events[event]; + profile->totaltimestops+=BAMBOO_GET_EXE_TIME(); + profile->numstops++; +} + +void printResults() { + for(int core=0;corecores[core].events[event]; + if (profile->numstarts!=profile->numstops) { + printf(" Mismatched starts and stops\n"); + } + long long totaltime=profile->totaltimestops-profile->totaltimestarts; + printf(" Total time: %llu Total events: %u Average time:%f\n", totaltime, profile->numstarts, ((double)totaltime)/profile->numstarts); + } + } +} diff --git a/Robust/src/Runtime/bamboo/multicoreprofile.h b/Robust/src/Runtime/bamboo/multicoreprofile.h new file mode 100644 index 00000000..4c0e0bac --- /dev/null +++ b/Robust/src/Runtime/bamboo/multicoreprofile.h @@ -0,0 +1,32 @@ +#ifndef MULTICOREPROFILE_H +#define MULTICOREPROFILE_H + +enum profileevents { + GCTIME, + NUMEVENTS; +}; + +char ** eventnames={"gctime", "endmarker"}; + +struct eventprofile { + long long totaltimestarts; + long long totaltimestops; + int numstarts; + int numstops; +}; + +struct coreprofile { + struct eventprofile events[NUMEVENTS]; +}; + +struct profiledata { + struct coreprofile cores[NUMCORES]; +}; + +extern struct profiledata * eventdata; + +void startEvent(enum eventprofile event); +void stopEvent(enum eventprofile event); +void printResults(); + +#endif -- 2.34.1