playMaker

Author Topic: Frequency monitor for loops? (CPU optimization tool)  (Read 2449 times)

Andrew_Raphael_Lukasik

  • Full Member
  • ***
  • Posts: 134
    • View Profile
    • my twitter @andrewlukasik
Frequency monitor for loops? (CPU optimization tool)
« on: October 25, 2011, 09:32:00 AM »
I thought about this for a long time - is there any simple way to make PM tell us which loops are making too much CPU delays etc? Is there any simply reachable data here to help us keep performance easier?

Even something like a number visible next to link - telling how many time that link was fired in past X seconds/frames(?) would be very helpful yet

  I write about this because i had a lot of issues with this in the past, and I know that not being conscious about that may be very discouraging as FPS drops rapidly having no idea why (blames goes to PM of course then).
Now I have to allocate some brain resources to virtually monitor that. I know that it wont hurt anybody, BUT - if Playmaker want to be that awesome tool for a designers (not very technical guys) then it could be really wise to address that IMHO

Regards
Andrew
« Last Edit: October 25, 2011, 01:24:29 PM by Andrew_Raphael_Lukasik »

Andrew_Raphael_Lukasik

  • Full Member
  • ***
  • Posts: 134
    • View Profile
    • my twitter @andrewlukasik
Re: Frequency monitor for loops? (CPU optimization tool)
« Reply #1 on: October 28, 2011, 01:38:29 AM »
Gentlemen, what you think about this?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3202
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Frequency monitor for loops? (CPU optimization tool)
« Reply #2 on: October 29, 2011, 03:43:00 AM »
Seems like a great idea! You can see how long a state was active in the FSM log window, which might help in some situations. But I agree more performance feedback would be useful.

Andrew_Raphael_Lukasik

  • Full Member
  • ***
  • Posts: 134
    • View Profile
    • my twitter @andrewlukasik
Re: Frequency monitor for loops? (CPU optimization tool)
« Reply #3 on: October 31, 2011, 02:53:36 PM »
Its true, debugging with log window opened often is a must (very useful)
  But one problem with it is that it's content is kinda nearly like raw data - I mean not very visual as expected from a "visual" (i.e. easy/fast to read) scripting tool. And with few FSMs firing events to each one another they can easily form loops that can be tricky to be aware and control/scale its impact on fps.

 I'm not totally sure how to address that but I was thinking about two ideas so far:
1. States with frequency counters (mentioned before)
and
2. PM has now something like infinite-loop detection. So maybe it can easily report heavy or suspicious loops that have been created?
« Last Edit: November 01, 2011, 04:52:02 AM by Andrew_Raphael_Lukasik »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Frequency monitor for loops? (CPU optimization tool)
« Reply #4 on: October 31, 2011, 10:45:28 PM »
Hi,

 Statistics about states, links and transitions is most welcome yes.

 What I would really enjoy is to be able to record a trace, and/or define how long the green path stays visible. Even if it's slowing down to very bad performances, this is very very important to debug complex diagrams.

Press a "record flow" button while you play the scene, then stop when you have reached your problem. Then you can analyze what went on, in your own time, not having to try to be faster than the machine to go from one fsm to another and find where the problem is.


 Bye,

 Jean

Andrew_Raphael_Lukasik

  • Full Member
  • ***
  • Posts: 134
    • View Profile
    • my twitter @andrewlukasik
Re: Frequency monitor for loops? (CPU optimization tool)
« Reply #5 on: November 01, 2011, 05:03:17 AM »
^vote+1

(I would be delighted to see first improvements in this field in coming releases, even small ones)

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3202
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Frequency monitor for loops? (CPU optimization tool)
« Reply #6 on: December 13, 2011, 11:41:46 AM »
The flow is actually recorded already - you can see it in the Debug Log Window.

The Log Window shows state transitions and events sent. It's also clickable, so you can quickly navigate to states. E.g., click on the Sent By line to go to the FSM and State that sent an event. I'm not sure how many people know about or use the Log Window, but it's a pretty powerful way to debug!

However it's probably not great for the case where you're looping through a state hundreds of times. Maybe a collapse option that just showed the number of times entered would be useful...?

Anyway, I'd appreciate any feedback on how the Log Window might be improved. And other info/presentations that might be useful - screenshot mockups highly appreciated!!

I agree that a more visual way to scrub time in the main view would be very handy. The data is there, just need to figure out a good UI.

It's also easy to expose the fade time of the green arrow, so I'll get that into the next update. Good suggestion! Would you want complete control, or would settings be sufficient (0.5 seconds, 1 second, 5 seconds, 10 seconds).  The settings would fit better in the debug menu, whereas a float field would work better in the Preferences panel.

EDIT: One idea I was toying with for the Log Window is pausing the game and setting the current game time when you click on a log line. Then as you switch between FSM logs the log line at that game time would also be highlighted. Basically to make it easier to see what's happening across FSMs at the same time...
« Last Edit: December 13, 2011, 11:48:22 AM by alexchouls »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Frequency monitor for loops? (CPU optimization tool)
« Reply #7 on: December 15, 2011, 12:00:28 AM »
Hi Alex,

 Yes Yes!! fade time, time srubber, all this would be excellent!

 One suggestion has you seem to say data is there is the following ( might be a far reach tho..)

 We would play the thing, and pause
at this point, we would be able to have a timeline with a slider representing the flow of information from start to now. Adjusting this slider filters the flow and display the related log entries AND the fsm state at that time.

 Is that possible? sometimes something went wrong and I can't figure out what because I lost track of what happened and it happened too quickly, being able to replay ( not even in the actual scene, just in the fsm, from a pur flow and logical point of view).

 Like a time machine... easy!...

I would be ok if we had to flag this before playing. Maybe this can take other forms, like for example "watching" a variable, and then see when it has changed and how. That would be good too.

Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Frequency monitor for loops? (CPU optimization tool)
« Reply #8 on: December 19, 2011, 11:28:39 PM »
Hi Alex,

 I am so happy that you actually did this time machine :)

 Now You got me thinking some more:

As the game is playing, sometimes we see something happening, we then pause, and then we have litteraly hundreds of log entries spreadout in a dozen of fsm...

 If I could have a very simple interface that while playing I can press a button and while I press or until I press it again, it stamps the log with a color or a flag, so that when I study the flow, I can go straight away to that timelaps and/or visually scroll in the log until I find this timelaps.

 Also, maybe we could set this with some custom action or with the debug system so that within a state I can react by code OR with an action to flag the log on and off.

That would be nice on your soon to be timeline as well,

also, another note on this log flow visuals. It would be nice as well to define either a time for the flow ( in yellow) so that we say: I want to visually see the flow 2 seconds up to the current selected log entry. OR for a number of state transitions: I want to see the  the previous 4 states before this log entry. AND in another color, the next sequence of flow, it's equally important to see where the flow is going from a selected log entry. Maybe in a different color?

Next: I am sure it's possible, and would be a great thing: Can you compose the flow into a video? or at least each log entry into an image that we can then compose in another software. OR maybe you are planning on letting us access this via api and control the flow with a custom editor so that we actually can do that ourselves? I am coming here again from a documentation/tutorial point of view where since we don't have a "demo" of playmaker to share with non licenses users, being able to show how it works is very important.

 You've spawn something very powerful Alex, keep amazing us!

Bye,

 Jean

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3202
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Frequency monitor for loops? (CPU optimization tool)
« Reply #9 on: December 20, 2011, 09:54:52 PM »
Great ideas Jean!

Stamping the log with a color seems very doable for this release. I was a little surprised how much the state colors helped the legibility of the Fsm Log, so I'm all for using color now!

Was playing around with other ways to enter the step size, but haven't settled on a UI. Don't want something too complicated! If you have something in mind I'd love a mockup :)

Not sure if the Timeline Window will make it into this release... there are some bug fixes and perf improvements in this update that I don't want to hold up too long. But this is definitely something I want to refine over the next few updates!

I've been meaning to look into screen/video capture of EditorWindows in Unity, but haven't had a chance yet...




jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Frequency monitor for loops? (CPU optimization tool)
« Reply #10 on: December 20, 2011, 10:25:08 PM »
Hi Alex,

 Don't rush on release features, timeline will wait then. Make it stable, this is key, we'll wait the time you need for all of this! really.

Played some more with the flow, and actually alloed me to see that in arrayMaker, I was firing too much events because I relied on GUI.changed and I though it happened once per click on the ui, so your log flow and visualy really helped here from day 1!!

 Now, on tight loops ( like in this particular case where the same event is repeatably called), the yellow glow of the flow becomes unusable because it shows too much of the previous log flow. I think yet another very important way to control the yellow flow is to have have it start at the triggering global event ( instead of time dependant as it is currently). Else it's yellow over yellow...

What do you mean by step size?

Bye,

 Jean

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3202
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Frequency monitor for loops? (CPU optimization tool)
« Reply #11 on: December 20, 2011, 10:34:06 PM »
By step size I mean some UI to say move forward 2 seconds, or back 5 state transitions etc.

But reading your idea again, maybe that's not what you meant :)

Are you talking about defining a time window with a second yellow bar?


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Frequency monitor for loops? (CPU optimization tool)
« Reply #12 on: December 21, 2011, 02:38:43 AM »
Hi,

"Are you talking about defining a time window with a second yellow bar?"

I think that's what I meant yes.Let me rephrase:

 Application is running. I press a button, it stamps the log at that time, I do something in app, etc, then I press again that button, and it stamps the current time. I end up with a start and end marker in the log so that I can quickly refer to what happened during that time.


-------------------start=====================stop----------------------

In the log, we could have a vertical side bar showing this and maybe a ui for going to the start time or the stop time. All log entries between start and stop can be tagged with a color or outlined somehow visually. and why not being able to only show the log between start and stop without actually loosing any of the log entries outside stat and stop.

Hopefully that explain better what I mean.

 Bye,

 Jean