Search Unity

FPS Graph - Performance Analyzer Tool

Discussion in 'Assets and Asset Store' started by dentedpixel, Jan 18, 2013.

  1. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hi HoldingJason,
    I am sorry you are having some trouble with the package. I just tried myself to export that scene with Unity 4.6.2 on my Amazon Fire and it is working fine.

    Does the Galaxy, Droid use an Intel chip by chance? Not sure why they wouldn't support GL functions. I would figure that would be a requirement for all devices to support that...
    I wish I had more than my Fire to test with. If you see of any work around on these devices, I would appreciate it.
    Thanks,
    Russ
     
  2. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    Hi Ross,
    I just bought the asset, it's great.
    I noticed the asset report the garbage collector allocation, but the asset itself produce some allocation, so it's kinda useless right now. Can you avoid the allocations, or at least give the option to not account for the memory allocation produced by the asset itself?
     
    dentedpixel likes this.
  3. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hi Christian,
    That's a good suggestion, I will look into this on the next release (I'll hopefully get a new one out soon to deal with some Android Intel chip issues soon).
     
  4. Tyen_

    Tyen_

    Joined:
    Jun 4, 2014
    Posts:
    12
    I just purchased this yesterday and have been trying it out.
    Unfortunately it appears as though the FPS calculation is quite off.

    I've compared it to my previous fps display script ( which I've attached ), and with fraps while in a standalone build. Both of them display the same result. But the fps-graph is still quite off. Is the FPS display on the hud not actually the application fps?

    I like the graphing display and performance display, but I do require it to be accurate. Hope you'll be able to take a look.

    I'm using Unity 4.5.4.f1.
     

    Attached Files:

  5. jimmay

    jimmay

    Joined:
    Sep 23, 2010
    Posts:
    28
    I was actually just coming here to post the exact same thing as Tyen_. The FPS calculation is incorrect vs the HUDfps script and the profiler fps.
     
  6. IgorLvov

    IgorLvov

    Joined:
    Oct 1, 2014
    Posts:
    2
    Hi there

    http://take.ms/kd8wr

    the FPS graph mean does not correspond to FPS value
    device iPad Air

    dentedpixel, would you like to explain or fix that

    maibe , I doing something wrong ?
     
  7. IgorLvov

    IgorLvov

    Joined:
    Oct 1, 2014
    Posts:
    2
  8. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey there, I think those numbers got out of sync when I did a reworking of the frame calculations recently. I will look into fixing this, this weekend. Thanks for letting me know! I'll hopefully post on here with a fix soon...
     
  9. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hey Guys,

    Thanks for your patience. I have a fix, I am going to submit to the Asset Store shortly. If anyone wants the fix before that please DM me.

    Another cool thing being included:
    - Ability to pin the graph to different alignments (Top-Left, Bottom-Right, etc).
     
  10. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,642
    Can I expect a Unity 4.6 GUI version of this? Our game is not using any GUI camera and I won't add a camera just for this.
     
  11. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    I didn't realize people were still doing active development on the 4.6.x branch :)

    Do you mean it's a camera but without the GUI Layer Component? I tested a release I was going to put out shortly and it works fine with this type of camera.
     
  12. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,642
    no, I meant, can you please update the code to use the new GUI system? The new GUI system doesn't use OnGUI and doesn't need a GUI dedicated camera. You are still using the old GUI system which is incompatible with our project.

    I didn't understand what you meant with the 4.6.x branch. If you meant as Unity branch, we are actually using 5.3.1
     
  13. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Oh, gotcha, you just meant the new UI tools. I think I might able to modify it. Is there an example of a project that doesn't use a dedicated camera? Is this a VR project? Sorry for my ignorance, I have always worked on projects that have some sort of dedicated camera.
     
  14. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,642
    To keep it simple, what I need is to create the chart game object and see it working immediately, without the need to setup a dedicated camera. This is what happens with other plugins that already updated to the new UI tools.
     
  15. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hmmm, it's really only setup to be seen through the Scene view and not in the editor. So there would have to be some type of camera, that is telling Unity what to show in the scene view...

    Because the graph uses OpenGL drawing calls, it's not really meant to exist outside of a camera view. Awhile back I tried it with just updating a texture object, and it was suuuuper slow, so that wouldn't be a good idea for an asset that is meant to debug performance.
     
  16. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,642
    Sorry, unluckily I am doing multiple things and I am not able to explain myself clearly.
    A scene must have a camera to work of course and your plugin should be able to work with the mainCamera, without needing to add a new camera just for it. Again, this is what other plugins already are doing (exploiting the new UI tool features). I suggest to check them.
     
  17. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    A lot of people are experiencing performance issues with Unity 5.x, especially on mobile platforms. So yes, plenty of people are still working on projects using Unity 4.6.x (or 4.7).
     
  18. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Gotcha, I think I get it now. I am working on a version that will automatically flip to the latest current camera. I think I am close to having a working solution, I'll let you know when I do.
     
  19. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Thanks Deozaan for the heads up. Actually we are only using 4.x branches at my work, so I should have realized many others are in the same boat (although I have been using 5.x for my personal development). I'll make sure to include a 4.x version in the next update.
     
  20. Michaelbgdrs

    Michaelbgdrs

    Joined:
    May 1, 2014
    Posts:
    27
    Greetings ,

    bought your fps asset.

    Great work except one thing.

    It shows fps correctly when used on a monitor monitor build with dk2 switched off , but when in dk2 is enabled it shows half and a bit less fps.

    Tested with a single cube scene with a GTX 980 so i am pretty sure what i write here is correct.

    Can you kindly upload a fix.


    Thank you in advance

    Michael.
     
  21. Michaelbgdrs

    Michaelbgdrs

    Joined:
    May 1, 2014
    Posts:
    27
    After several tests , unfortunately it shows everything wrong.

    Wrong fps , wrong texture usage , wrong items in scene.

    Also there is huge performance drop.

    Can you kindly explain why?
     
  22. BrightBit

    BrightBit

    Joined:
    Jan 22, 2013
    Posts:
    265
    The red indications of garbage collection events are erroneous.

    To fix it you need to change the lines:

    Code (CSharp):
    1. if (lastCollectionCount != System.GC.CollectionCount(0))
    2. {
    3.     gcHistory[frameIter] = 1;
    4.     lastCollectionCount = System.GC.CollectionCount(0);
    5. }
    ...to:

    Code (CSharp):
    1. if (lastCollectionCount != System.GC.CollectionCount(0))
    2. {
    3.     gcHistory[frameIter] = 1;
    4.     lastCollectionCount = System.GC.CollectionCount(0);
    5. }
    6. else gcHistory[frameIter] = 0;
     
  23. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Cheers, thanks for the fix BrightBit!
     
  24. BrightBit

    BrightBit

    Joined:
    Jan 22, 2013
    Posts:
    265
    You're welcome. :)
     
  25. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    452
    Hi,

    FYI. On iPad Pro 9" I'm getting artifacts and flickering. It took a while to find out that it was the FPS plugin that it was causing it. Just a heads up, but you might want to test it on that h/w.

    Regards,
    Tom
     
    dentedpixel likes this.
  26. mgto

    mgto

    Joined:
    May 30, 2013
    Posts:
    22
    It's crashing for me here:

    Unity 5.5 and Unity 5.6

    [Exception] IndexOutOfRangeException: Array index is out of range.
    FPSGraphC.addNumberAt() Assets/ExternScripts/_Scripting/GUI/FPSGraph/FPSGraphC.cs:294
    Code (CSharp):
    1. 292:   for(k=startAt; k < xLength; k++){
    2. 293:       //textOverlayMask[yExtern, xExtern] = num==-1 ? 0 : numberBits[ yOffset + x ];
    3. -->294:       if(num!=-1 && numberBits[ yOffset + k ] == 1){
    4. 295:           x1 = xExtern * graphMultiply + xOff;
    5. 296:           y1 = yExtern * graphMultiply + yOff;
    6.  
    FPSGraphC+<OnPostRender>c__Iterator0.MoveNext() Assets/ExternScripts/_Scripting/GUI/FPSGraph/FPSGraphC.cs:651
    Code (CSharp):
    1. 649:   first = (int)mem;
    2. -->651:   addNumberAt( 96, -7, (int)(first/100), false );
    3. 652:   addNumberAt( 100, -7, first%100/10, false );
    4. 653:   addNumberAt( 104, -7, first%10, false );
    5.  
    UnityEngine.SetupCoroutine.InvokeMoveNext() C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17
     
  27. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Hi there,

    If you replace the line 294 with:
    if(num!=-1 && yOffsetAdd < numberBits.Length && numberBits[ yOffsetAdd ] == 1){

    It should avoid your error. I have also submitted an update to the Asset Store with this fix if you want to wait for that.

    Thanks!
    Russ
     
  28. chunk_split

    chunk_split

    Joined:
    Dec 25, 2017
    Posts:
    7
    For anyone curious/interested in using this in VR (i.e. in arbitrary 3D space instead of directly drawn to screen), I found a way to add support for this via RenderTexture.

    Warning: This is a hack, I'll admit I don't really know what I'm doing here so there could be flaws/issues with this.

    Steps:
    1. Ensure you have graph positioning set to bottom left.
    2. Set graph multiply to 12.
    3. Create a new render texture and set the dimensions to 256 x 256 (should be that way by default anyway)
    4. Create a quad in your scene and assign that render texture to it.
    5. Into the code: Add the member variable to the FPSGraphC class so you can associate your own render texture:

      public RenderTexture targetTexture;

    6. Now back to the editor, drag-and-drop that render texture to the new public field you just created.
    7. Back to the code: In OnPostRender(), after the line containing "yield return new WaitForEndOfFrame();" statement, add the following which forces rendering to the assigned render texture:

      RenderTexture currentActiveRT = RenderTexture.active;
      if (targetTexture != null) {
      RenderTexture.active = targetTexture;
      GL.Clear( false, true, Color.black );
      }

    8. Finally, at the bottom of OnPostRender(), add this which returns rendering back to the currently active ... thing-a-ma-jig (I think this will return back to previous state):

      RenderTexture.active = currentActiveRT;
    Once you start your game, you should see the stats rendering to your quad. Again... if things break, well that's your fault -- I warned you :)
     
    dentedpixel likes this.
  29. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    Thanks for the detailed explanation! I have included a VR example scene in the package in the store (just uploaded it so should be available within the week). I tweaked a couple of things but basically used your idea. Cheers!
     
  30. Deleted User

    Deleted User

    Guest

    I just started using Unity Cloud Build and the FPSGraph package is failing to build, not recognizing the Profiler class reference in FPSGraphC.cs

    I don't think it's a bug in FPSGraph, but rather a quirk in Unity Cloud Build, as the reference to Profiler is guarded by

    #if UNITY_PRO_LICENSE

    and Unity Cloud Build is recognizing that define but I don't actually have a pro license (just a personal license and Unity Team Advanced). So my workaround is simply to stub out that line in FPSGraphC.cs. Just an FYI, in case anyone else runs into this.
     
    dentedpixel likes this.
  31. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    Hi,
    It's impossible to read the text, how are supposed to know what level it's at?

    Any way of making it better?
     
  32. dentedpixel

    dentedpixel

    Joined:
    Jul 15, 2012
    Posts:
    683
    You can change the zoom level to make it more readable via the "GraphMultiply" variable
     
    Deleted User likes this.
  33. marserMD

    marserMD

    Joined:
    Aug 29, 2014
    Posts:
    191
    Hi there!

    There is a bug in your code repeated many times. You are writing this
    Code (CSharp):
    1. splitMb = mem.ToString("F2").Split("."[0]);
    Assuming that you'll receive the parts before and after the [decimal separator](https://en.wikipedia.org/wiki/Decimal_separator). But in many countries ',' is used instead of '.' leading to exception later in the code.

    I would also suggest using math instead of ToString, since it will eliminate the allocations.
    From the top of my head:
    Code (CSharp):
    1. int fraction = (int)(f * 100 - ((int)f) * 100);
    2.  
     
  34. TylerCode_

    TylerCode_

    Joined:
    Sep 8, 2010
    Posts:
    221
    I know I'm necroing the thread but does this work with any of the SRPs? I see it is supposed to render to texture but I was hoping to use it with URP.

    Edit: Audio is working but I don't see anything even using render texture.
     
    radiantboy likes this.
  35. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    I cant see this, is it not working in URP?