Revision 1c72663d

View differences:

src/eventlog/sequencechartfacade.cc
41 41

  
42 42
    smallestDuration = -1;
43 43
    largestDuration = -1;
44

  
45
    cachedParallelSet.clear();
44 46
}
45 47

  
46 48
void SequenceChartFacade::synchronize(FileReader::FileChangedState change)
......
745 747
{
746 748
    return getLargestParallelSetSize(event) <= threshold;
747 749
}
750
/*
751
 * Returns whether event is in the largest parallel set of selected.
752
 */
753
bool SequenceChartFacade::isParallelWithEvent(IEvent* event, IEvent* selected) {
754

  
755
    if (lastSelected != selected) {
756
        getLargestParallelSet(selected, &cachedParallelSet);
757
    }
758
    return cachedParallelSet.find((ptr_t)event) != cachedParallelSet.end();
759
}
748 760

  
749 761
unsigned int SequenceChartFacade::getLargestParallelSetSize(IEvent* event)
750 762
{
......
767 779
    return previousSize;
768 780
}
769 781

  
782
std::set<ptr_t>* SequenceChartFacade::getLargestParallelSet(IEvent* event, std::set<ptr_t>* parallelSet) {
783
    IEvent* prev = event;
784
    parallelSet->clear();
785
    while (prev)
786
    {
787
        getParallelSet(prev, parallelSet);
788
        if (parallelSet->find((ptr_t) event) == parallelSet->end())
789
        {
790
            break;
791
        }
792
        prev = prev->getPreviousEvent();
793
    }
794

  
795
    if (prev != event) {
796
        getParallelSet(prev->getNextEvent(), parallelSet);
797
    }
798
    return parallelSet;
799
}
800

  
770 801
void SequenceChartFacade::getParallelSet(IEvent* event,
771 802
        std::set<ptr_t>* parallelSet)
772 803
{
src/eventlog/sequencechartfacade.h
51 51
        simtime_t smallestDuration;
52 52
        simtime_t largestDuration;
53 53

  
54
        std::set<ptr_t> cachedParallelSet;
55
        IEvent* lastSelected;
56

  
54 57
    public:
55 58
        SequenceChartFacade(IEventLog *eventLog);
56 59
        virtual ~SequenceChartFacade() {}
......
111 114
        */
112 115
        bool isBottleneck(IEvent* event, unsigned int threshold);
113 116

  
117
        bool isParallelWithEvent(IEvent* event, IEvent* selected);
118

  
114 119
        IEvent* getPreviousBottleneck(IEvent* e, unsigned int threshold);
115 120
        IEvent* getNextBottleneck(IEvent* e, unsigned int threshold);
116 121

  
......
138 143
            simtime_t &nextEventSimulationTime, double &nextEventTimelineCoordinate,
139 144
            simtime_t &simulationTimeDelta, double &timelineCoordinateDelta);
140 145

  
146
        std::set<ptr_t>* getLargestParallelSet(IEvent* event, std::set<ptr_t>* parallelSet);
141 147

  
142 148
        unsigned int getLargestParallelSetSize(IEvent* event);
143 149

  

Also available in: Unified diff