Source Generation Process , INSTANCE.get()

Hello

I have some problems with the SourceGen process.

My ultimate goal is to find out how fast textGen is under different parameters for an exampleSolution.  I also need to log those times and so that I can make some statistics.

The process would be : 1) change some things in the solution  2)  invoke textGen   3) log the time it took

And that a few houndred or thousand times.

I tryed to build something like that by taking inspiration from  the "TextPreviewModel" action , I basicily did put the whole code in a loop, and I write the files that are in the memory after the "textGenToMemory"  to disk myself.

Now that works fine for the first iteration of the loop, but then the INSTANCE.get().openNewSession makes problems. I always get an Illegalte state exception.  It seeems like that the old session is not done yet when I run into the second iteration of my loop. But I didnt find a way to wait for it to be done.

 

Someone knows a better way or can explain me how INSTANCE is to be used.

 

Greetings

 

Jochen

 

 

 

 

 

2 comments

Have you considered making a build solution for your model, so that you can run the build from a command line? Because MPS will output things like this while building: you can just put the build in a loop in the commandline and then mine out the lines with "textGen" target execution time with some text filter like grep.

0

Thx for the tip. As this will surely not be the last time I have to do something like this, I will try your version next time.  I ran out of time so I used a UI mouse recording tool to start the action over and over... not a very satisfying solution.

0

Please sign in to leave a comment.