lf-lang / lingua-franca

Intuitive concurrent programming in any language
https://www.lf-lang.org
Other
240 stars 63 forks source link

Timing diagrams from LF programs and/or trace data #1423

Open lhstrh opened 2 years ago

lhstrh commented 2 years ago

It might be cool to synthesize some timing diagrams for subsets of LF programs that are driven purely by timers and/or based on execution traces. This idea was stimulated by PlantUML, which was brought to my attention by Grzegorz Bazydlo.

lsk567 commented 2 years ago

I like this idea a lot! Perhaps some sort of debugger could be built using this type of timing diagram.

cmnrd commented 2 years ago

I think @Rojods already did something like this by converting purely timer based programs to Forsyde.

Rojods commented 2 years ago

That would be an interesting addition to the ecosystem 😄 .

I indeed have a dormant timing-related transformation that could be useful for diagramming. Basically I had a subset of LF programs (as @cmnrd mentioned 😄) that contain only reactors, reactions, timers and delays (between reactions). From that managed to make a task-like model (extended dependencies periodic tasks it is called) from which I could do "conventional" timing analysis.

It was mostly for analysis, but the task-like model can certainly be used for an easier generation of timing diagrams as you mention. I'll paste here the example that I have in the dormant paper so you can judge what it could lead to. The "task timing diagram" in there was done by hand, but the idea is easy and algorithmic enough to be done automatically in polynomial time.

image image

I hope this helps on summarizing what I have! But of course, I am happy to have more questions 😄 .

lhstrh commented 2 years ago

@Rojods this looks extremely cool. Is there a way to get the code you used to produce this merged back into lingua-franca?

Rojods commented 2 years ago

There might be a way to get the job graph representation, @lhstrh 😄 . The code for generating the data structures still exist inside IDeSyDe, but the visualization itself never existed (sadly). Would that be already a start for your goals?

lhstrh commented 2 years ago

@Rojods, I see. Did you create the timing diagram manually? If followed the link you shared but it took me to the base of the repository. Could you point to a specific location in the code base?