Added alpha feature for enabling CCS communication with tracing modules via
[charm.git] / src / ck-perf / trace-summaryBOC.h
1 #include "ckcallback-ccs.h"
2 #include "TraceSummary.decl.h"
3
4 extern CkGroupID traceSummaryGID;
5 extern bool summaryCcsStreaming;
6
7 class TraceSummaryInit : public Chare {
8  public:
9   TraceSummaryInit(CkArgMsg *m) {
10     traceSummaryGID = CProxy_TraceSummaryBOC::ckNew();
11     CProxy_TraceSummaryBOC sumProxy(traceSummaryGID);
12
13     CkCallback *cb = new CkCallback(CkIndex_TraceSummaryBOC::sendSummaryBOC(NULL), 0, sumProxy);
14     CProxy_TraceSummaryBOC(traceSummaryGID).ckSetReductionClient(cb);
15
16     // No CCS Streaming support until user-code requires it.
17     summaryCcsStreaming = CmiFalse;
18   }
19   TraceSummaryInit(CkMigrateMessage *m):Chare(m) {}
20 };
21
22 class TraceSummaryBOC : public CBase_TraceSummaryBOC {
23 private:
24   int count;
25   BinEntry *bins;
26   int  nBins;
27   int nTracedPEs;
28
29 public:
30   /* CCS support variables */
31   int lastRequestedIndexBlock;
32   int indicesPerBlock;
33   double collectionGranularity; /* time in seconds */
34   int nBufferedBins;
35   CkVec<double> *ccsBufferedData;
36   int nextBinIndexCcs;
37
38 public:
39   TraceSummaryBOC(void): count(0), bins(NULL), nBins(0), 
40     nTracedPEs(0), nextBinIndexCcs(0) {};
41   TraceSummaryBOC(CkMigrateMessage *m):CBase_TraceSummaryBOC(m) {};
42   void startSumOnly();
43   void askSummary(int size);
44   void sendSummaryBOC(CkReductionMsg *);
45
46   /* CCS support methods/entry methods */
47   void initCCS();
48   void ccsClientRequest(CkCcsRequestMsg *m);
49   void collectData(double startTime, double binSize, int numBins);
50   void dataCollected(CkReductionMsg *);
51 private:
52   void write();
53 };
54
55 void startCollectData(void *data, double currT);