diff --git a/app/benchmark/timing/copter.cc b/app/benchmark/timing/copter.cc index 2fde270692ac2ac6eb3e52b4e500ef5188745448..d9d280391fee47703e97558a266de0cbd8cc2111 100644 --- a/app/benchmark/timing/copter.cc +++ b/app/benchmark/timing/copter.cc @@ -108,7 +108,6 @@ TASK(MavlinkSendTask) { } TASK(CopterControlTask) { - timing_end(TIMING_POINT_NO_INTERRUPTS_IN_BLOCK | 2); calculation(); SuspendAllInterrupts(); @@ -116,16 +115,21 @@ TASK(CopterControlTask) { ResumeAllInterrupts(); calculation(); + /* Saves 8000 states if (round < 5) { CancelAlarm(CopterControlWatchdogAlarm); SetRelAlarm(CopterControlWatchdogAlarm, 100, 100); } calculation(); + */ + + timing_end(2); + TerminateTask(); } ISR2(MavlinkRecvHandler) { - timing_start(2 | TIMING_POINT_IS_HIGHEST_PRIO); + timing_start(2 | TIMING_POINT_START_INTERRUPT_FROM_IDLE); calculation_short(); ActivateTask(CopterControlTask); calculation_short(); diff --git a/generator/transform/GeneratePML.py b/generator/transform/GeneratePML.py index 0d35949141e9ed1b8b40f3d6e77830921547168c..c38ec49bb2f48abdd122110c4a6589ed93ae8ac1 100644 --- a/generator/transform/GeneratePML.py +++ b/generator/transform/GeneratePML.py @@ -20,6 +20,9 @@ def is_TIMING_POINT_NO_INTERRUPTS_IN_BLOCK(flags): def is_TIMING_POINT_IS_HIGHEST_PRIO(flags): return (flags & 4) == 4 +def is_TIMING_POINT_START_FROM_IDLE(flags): + return (flags & 8) == 8 + class GeneratePML(Analysis, GraphObject): @@ -104,6 +107,10 @@ class GeneratePML(Analysis, GraphObject): pass # Ignore state else: start_states[id(state)] = state + elif is_TIMING_POINT_START_FROM_IDLE(start_abbs.get(state.current_abb,0)): + # Only IRQ states from idle are allowed + if len(priority_map(state)) == 0: + start_states[id(state)] = state else: start_states[id(state)] = state @@ -451,6 +458,7 @@ class GeneratePML(Analysis, GraphObject): # Add a list of nodes: G.add_nodes_from(all_states.keys()) + logging.debug(" searching loops in %d-node graph (networkx)", len(all_states)) for a in all_states.values(): for b in a.get_outgoing_nodes(SavedStateTransition): diff --git a/os/timing.h b/os/timing.h index ef91aa2b0fdd554aff80840a6f326b5a8b2f7fba..9b8a5f9d578811d29094f1b4454837588fabebf2 100644 --- a/os/timing.h +++ b/os/timing.h @@ -25,6 +25,8 @@ extern "C" { #define TIMING_POINT_STOP_BEFORE 0x100 #define TIMING_POINT_START_INTERRUPT_IN_BLOCK 0x100 +#define TIMING_POINT_START_INTERRUPT_FROM_IDLE 0x800 +