Revision f270c074 src/eventlog/sequencechartfacade.cc

View differences:

src/eventlog/sequencechartfacade.cc
321 321
        {
322 322
            IEvent* res = eventLog->getFirstEventRealTime();
323 323
            for (IEvent *current = eventLog->getFirstEventRealTime(); current; current = current->getNextEventRealTime()) {
324
                if ((double) current->getEarliestStartTime() / 1000000.0 < timelineCoordinate) {
325
                    if (current->getEarliestStartTime() > res->getEarliestStartTime()) {
324
                if ((double) current->getEarliestProcessingTime() / 1000000.0 < timelineCoordinate) {
325
                    if (current->getEarliestProcessingTime() > res->getEarliestProcessingTime()) {
326 326
                        res = current;
327 327
                    }
328 328
                } else {
......
432 432
    }
433 433

  
434 434
    // linear approximation between two enclosing events
435
    nextEvent = event ? event->getNextEvent() : eventLog->getFirstEvent();
435
    if(timelineMode==REAL_TIME) {
436
        nextEvent = event ? event->getNextEventRealTime() : eventLog->getFirstEventRealTime();
437
    } else {
438
        nextEvent = event ? event->getNextEvent() : eventLog->getFirstEvent();
439
    }
436 440

  
437 441
    if (nextEvent) {
438 442
        if(timelineMode==REAL_TIME) {
......
601 605
    Assert(endEvent);
602 606
    std::vector<ptr_t> *moduleMethodBeginEntries = new std::vector<ptr_t>();
603 607

  
604
    for (IEvent *event = startEvent;; event = event->getNextEvent()) {
608
    for (IEvent *event = startEvent; event; event = timelineMode==REAL_TIME ? event->getNextEventRealTime() : event->getNextEvent()) {
605 609
        eventLog->progress();
606 610

  
607 611
        for (int i = 0; i < event->getNumEventLogEntries(); i++) {
......
626 630
    Assert(endEvent);
627 631
    std::set<ptr_t> messageDependencies;
628 632
    eventnumber_t startEventNumber = startEvent->getEventNumber();
629

  
630 633
    // TODO: LONG RUNNING OPERATION
631 634
    // this might take a while if start and end events are far away from each other
632 635
    // if not completed then some dependencies will not be included
633
    for (IEvent *event = startEvent;; event = event->getNextEvent()) {
636
    for (IEvent *event = startEvent; event; event = timelineMode==REAL_TIME ? event->getNextEventRealTime() : event->getNextEvent()) {
634 637
        eventLog->progress();
635 638
        IMessageDependencyList *causes = event->getCauses();
636

  
637 639
        for (IMessageDependencyList::iterator it = causes->begin(); it != causes->end(); it++) {
638 640
            IMessageDependency *messageDependency = *it;
639

  
640 641
            if (messageDependency->getCauseEventNumber() < startEventNumber)
641 642
                messageDependencies.insert((ptr_t)messageDependency);
642 643
        }
643

  
644 644
        IMessageDependencyList *consequences = event->getConsequences();
645

  
646 645
        for (IMessageDependencyList::iterator it = consequences->begin(); it != consequences->end(); it++)
647 646
            messageDependencies.insert((ptr_t)*it);
648

  
649 647
        if (event == endEvent)
650 648
            break;
651 649
    }
652

  
653 650
    std::vector<ptr_t> *result = new std::vector<ptr_t>;
654 651
    result->resize(messageDependencies.size());
655 652
    std::copy(messageDependencies.begin(), messageDependencies.end(), result->begin());
656

  
657 653
    return result;
658 654
}
659 655

  
......
958 954
void SequenceChartFacade::calculateCriticalPath() {
959 955
    long maxEarliestProcessingTime = 0;
960 956
    IEvent* maxEarliestProcessingTimeEvent;
961

  
957
    printf("bla1");
962 958
    for (IEvent *current = eventLog->getFirstEvent(); current; current = current->getNextEvent()) {
963 959
        simtime_t startTime = current->getSimulationTime();
964 960
        int moduleId = current->getModuleId();
965 961
        if(current->getEventEndEntry()) {
966 962
            current->_earliestProcessingTime = current->getComplexity();
967 963
        }
968

  
964
        printf("%i \n", current->getEventNumber());
969 965
        current->setCriticalPredecessor(eventLog->getFirstEvent());
970

  
971 966
        for (IEvent *antecessor = eventLog->getFirstEvent(); antecessor; antecessor = antecessor->getNextEvent()) {
972 967
            if(antecessor==current) {
973 968
                break; //We have to consider earlier events only
......
1015 1010
    case REAL_TIME:
1016 1011
    {
1017 1012
        //Use cached result when range contains all events
1018
        if (startEvent == eventLog->getFirstEvent() && endEvent
1019
                == eventLog->getLastEvent())
1013
        if (startEvent == eventLog->getFirstEventRealTime() && endEvent
1014
                == eventLog->getLastEventRealTime())
1020 1015
        {
1021 1016
            return (ptr_t) biggestEarliestProcessingTimeEvent;
1022 1017
        }
......
1025 1020
        IEvent* largestEvent = startEvent;
1026 1021

  
1027 1022
        for (IEvent* current = startEvent; current; current
1028
                = current->getNextEvent())
1023
                = current->getNextEventRealTime())
1029 1024
        {
1030 1025
            long temp = current->getEarliestProcessingTime();
1031 1026
            if (temp > largest)

Also available in: Unified diff