Revision daf081df

View differences:

src/envir/eventlogfilemgr.cc
163 163
        if (currentEvent != message->getPreviousEventNumber()) {
164 164
            currentEvent = message->getPreviousEventNumber();
165 165
            EventLogWriter::recordEventEntry_e_t_m_msg_d(feventlog, currentEvent, message->getSendingTime(), currentEvent == 0 ? simulation.getSystemModule()->getId() : message->getSenderModuleId(), -1,0);
166
            EventLogWriter::recordEventEndEntry_e_c(feventlog, currentEvent,0);
166 167
        }
167 168
        if (currentEvent == 0)
168 169
            componentMethodBegin(simulation.getSystemModule(), message->getSenderModule(), "initialize", empty_va);
......
227 228
        // TODO: we can't use simulation.getEventNumber() and simulation.getSimTime(), because when we start a new run
228 229
        // these numbers are still set from the previous run (i.e. not zero)
229 230
        EventLogWriter::recordEventEntry_e_t_m_msg_d(feventlog, 0, 0, simulation.getSystemModule()->getId(), -1,0);
231
        EventLogWriter::recordEventEndEntry_e_c(feventlog, 0,0);
230 232
        EventLogWriter::recordSimulationBeginEntry_v_rid(feventlog, OMNETPP_VERSION, runId);
231 233
        fflush(feventlog);
232 234
    }
......
291 293
    if (isEventLogRecordingEnabled)
292 294
    {
293 295
        EventLogWriter::recordEventEndEntry_e_c(feventlog, log_eventNumber,
294
                        complexity);
296
                        ((long)(1000*1000*complexity)));   //Store complexity in microseconds
295 297
    }
296 298
}
297 299

  
src/eventlog/event.cc
123 123

  
124 124
        if (!line) {
125 125
            Assert(eventEntry);
126
            Assert(eventEndEntry);
126 127
            endOffset = reader->getFileSize();
127 128
            return endOffset;
128 129
        }
......
154 155

  
155 156
        if(readEventEndEntry) {
156 157
            eventEndEntry = readEventEndEntry;
158
            continue;
157 159
        }
158 160

  
159 161
        // handle module method end
......
179 181
        if (dynamic_cast<BeginSendEntry *>(eventLogEntry))
180 182
            numBeginSendEntries++;
181 183
    }
184
    Assert(eventEndEntry);
182 185
    return endOffset = reader->getCurrentLineStartOffset();
183 186
}
184 187

  
src/eventlog/event.h
87 87

  
88 88
        virtual eventnumber_t getEventNumber() { return eventEntry->eventNumber; }
89 89
        virtual simtime_t getSimulationTime() { return eventEntry->simulationTime; }
90
	virtual long getComplexity() { return !eventEndEntry ? 1 : eventEndEntry->complexity; }
90 91
        virtual int getModuleId() { return eventEntry->moduleId; }
91 92
        virtual long getMessageId() { return eventEntry->messageId; }
92 93
        virtual eventnumber_t getCauseEventNumber() { return eventEntry->causeEventNumber; }
src/eventlog/eventlogentries.txt
102 102
EE EventEndEntry //indicates end of an event
103 103
{
104 104
   e eventnumber_t eventNumber          // event number of the corresponding event
105
   c simtime_t complexity               // measured complexity of event in seconds (stored in simtime_t for compatibility issues)
105
   c long complexity                    // measured complexity of event in microseconds (stored in simtime_t for compatibility issues)
106 106
}
107 107

  
108 108
CE CancelEventEntry // canceling an event caused by self message
src/eventlog/filteredevent.h
84 84

  
85 85
        virtual eventnumber_t getEventNumber() { return eventNumber; }
86 86
        virtual simtime_t getSimulationTime() { return getEvent()->getSimulationTime(); }
87
	virtual long getComplexity() { return getEvent()->getComplexity(); }
87 88
        virtual int getModuleId() { return getEvent()->getModuleId(); }
88 89
        virtual long getMessageId() { return getEvent()->getMessageId(); }
89 90
        virtual eventnumber_t getCauseEventNumber() { return getEvent()->getCauseEventNumber(); }
src/eventlog/ievent.h
83 83
        // some of the data found in the 'E' entry (line), to get additional data query the entries
84 84
        virtual eventnumber_t getEventNumber() = 0;
85 85
        virtual simtime_t getSimulationTime() = 0;
86
	virtual long getComplexity() = 0;
86 87
        virtual int getModuleId() = 0;
87 88
        virtual long getMessageId() = 0;
88 89
        virtual eventnumber_t getCauseEventNumber() = 0;
src/eventlog/sequencechartfacade.cc
35 35

  
36 36
    nonLinearMinimumTimelineCoordinateDelta = 0.1;
37 37
    setNonLinearFocus(calculateNonLinearFocus());
38

  
39
    smallestComplexity = -1;
40
    largestComplexity = -1;
38 41
}
39 42

  
40 43
void SequenceChartFacade::synchronize(FileReader::FileChangedState change)
......
611 614

  
612 615
    return adjacencyMatrix;
613 616
}
617

  
618

  
619
long SequenceChartFacade::getSmallestEventComplexity() {
620
    long complexity = 0;
621
    if (smallestComplexity < 0) {
622
        for (IEvent *event = eventLog->getFirstEvent();event != eventLog->getLastEvent(); event = event->getNextEvent()) {
623
             if (event->getEventEndEntry()) {
624
                 complexity = event->getEventEndEntry()->complexity;
625
             }
626
             if (complexity < smallestComplexity || smallestComplexity < 0) {
627
                 smallestComplexity = complexity;
628
             }
629
             if (complexity > largestComplexity || largestComplexity < 0) {
630
                 largestComplexity = complexity;
631
             }
632
        }
633
    }
634
    if (smallestComplexity < 0) {
635
        smallestComplexity = 0;
636
    }
637
    return smallestComplexity;
638
}
639

  
640
long SequenceChartFacade::getLargestEventComplexity() {
641
    if (largestComplexity < 0) {
642
        getSmallestEventComplexity();
643
    }
644
    if (largestComplexity < 0) {
645
        largestComplexity = 0;
646
    }
647
    return largestComplexity;
648
}
src/eventlog/sequencechartfacade.h
45 45
        double nonLinearMinimumTimelineCoordinateDelta;
46 46
        double nonLinearFocus;
47 47

  
48
        long smallestComplexity;
49
        long largestComplexity;
50

  
48 51
    public:
49 52
        SequenceChartFacade(IEventLog *eventLog);
50 53
        virtual ~SequenceChartFacade() {}
......
78 81
        IEvent *getLastEventNotAfterTimelineCoordinate(double timelineCoordinate);
79 82
        IEvent *getFirstEventNotBeforeTimelineCoordinate(double timelineCoordinate);
80 83

  
84
        /*
85
         * returns smallest event complexity in the event log
86
         */
87
        long getSmallestEventComplexity();
88
        /*
89
         * returns largest event complexity in the event log
90
         */
91
        long getLargestEventComplexity();
92

  
81 93
        /**
82 94
         * Timeline coordinate can be given in the range (-infinity, +infinity).
83 95
         * Simulation time will be in the range [0, lastEventSimulationTime].

Also available in: Unified diff