// // This file is part of an OMNeT++/OMNEST simulation example. // // Copyright (C) 1992-2008 Andras Varga // // This file is distributed WITHOUT ANY WARRANTY. See the file // `license' for details on this and other legal matters. // #include #define STACKSIZE 16384 using namespace std; /** * Demonstrates histogram classes; see NED file for more info. */ class HistogramDemo: public cSimpleModule { public: HistogramDemo() : cSimpleModule(STACKSIZE) { } virtual void activity(); }; Define_Module(HistogramDemo); void HistogramDemo::activity() { cVarHistogram hist(NULL, 4 , HIST_TR_NO_TRANSFORM); hist.addBinBound(32); hist.addBinBound(64); hist.addBinBound(256); hist.addBinBound(512); for (int i = 0; i < 1000; i++) { if (i < 500) hist.collect(64); else hist.collect(256); } hist.record(); endSimulation(); }