New functionality in CCS streaming of sum detail data for projections. The reduction...
[charm.git] / src / ck-perf / trace-summaryBOC.h
1 #include "ckcallback-ccs.h"
2 #include "TraceSummary.decl.h"
3 #include <deque>
4
5 extern CkGroupID traceSummaryGID;
6 extern bool summaryCcsStreaming;
7
8 class TraceSummaryInit : public Chare {
9  public:
10   TraceSummaryInit(CkArgMsg *m) {
11     traceSummaryGID = CProxy_TraceSummaryBOC::ckNew();
12     CProxy_TraceSummaryBOC sumProxy(traceSummaryGID);
13
14     CkCallback *cb = new CkCallback(CkIndex_TraceSummaryBOC::sendSummaryBOC(NULL), 0, sumProxy);
15     CProxy_TraceSummaryBOC(traceSummaryGID).ckSetReductionClient(cb);
16
17     // No CCS Streaming support until user-code requires it.
18     summaryCcsStreaming = CmiFalse;
19   }
20   TraceSummaryInit(CkMigrateMessage *m):Chare(m) {}
21 };
22
23 class TraceSummaryBOC : public CBase_TraceSummaryBOC {
24 private:
25   int count;
26   BinEntry *bins;
27   int  nBins;
28   int nTracedPEs;
29
30
31 public:
32   /* CCS support variables */
33   int lastRequestedIndexBlock;
34   int indicesPerBlock;
35   double collectionGranularity; /* time in seconds */
36   int nBufferedBins;
37   CkVec<double> *ccsBufferedData;
38   int nextBinIndexCcs;
39   std::deque<CkReductionMsg *> storedSumDetailResults;
40
41
42 public:
43   TraceSummaryBOC(void): count(0), bins(NULL), nBins(0), 
44     nTracedPEs(0), nextBinIndexCcs(0) {};
45   TraceSummaryBOC(CkMigrateMessage *m):CBase_TraceSummaryBOC(m) {};
46   void startSumOnly();
47   void askSummary(int size);
48   void sendSummaryBOC(CkReductionMsg *);
49
50   /* CCS support methods/entry methods */
51   void initCCS();
52   void ccsRequestSummaryDouble(CkCcsRequestMsg *m);
53   void ccsRequestSummaryUnsignedChar(CkCcsRequestMsg *m);
54   void ccsRequestSumDetailUnsignedChar(CkCcsRequestMsg *m);
55   void ccsRequestSumDetailCompressed(CkCcsRequestMsg *m);
56   void ccsRequestSumDetailCompressedPE0(CkCcsRequestMsg *m);
57
58   void collectSummaryData(double startTime, double binSize, int numBins);
59   void summaryDataCollected(CkReductionMsg *);
60   void collectSumDetailData(double startTime, double binSize, int numBins);
61   void sumDetailDataCollected(CkReductionMsg *);
62
63 private:
64   void write();
65 };
66
67 void startCollectData(void *data, double currT);