Search Unity

Advanced FPS Counter [RELEASED]

Discussion in 'Assets and Asset Store' started by codestage, Feb 12, 2014.

  1. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey @Gleb_Palchin,

    this should be fixed now in latest version.

    Here is a changelog of this minor update (please note asmdef names were changed a bit to match official guidelines which can require reference reassignment):
     
  2. StenCG

    StenCG

    Joined:
    Mar 26, 2015
    Posts:
    66
    Version 1.4.5 have problem in Unity 2020. Not show "Device Info" on first run, need toggle plugin to show. No errors as I see it.
     
    codestage likes this.
  3. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    @Stanislawe thank you for reporting this problem will take a look and fix with next update!
     
    StenCG likes this.
  4. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey @Stanislawe ,

    It should be now fixed in latest 1.4.6 version, thank you for reporting it once again!

    Please let me know if it's still reproduces for you.
     
    StenCG likes this.
  5. Gleb_Palchin

    Gleb_Palchin

    Joined:
    Jan 7, 2016
    Posts:
    22
    Hey @codestage
    Version 1.4.6 is causing some crashes on my side.
    Steps to reproduce:

    Create a new project in Unity 2019.4.14f1
    Import Advanced FPS asset
    Drag and Drop the Advanced FPS prefab
    Play the scene

    Result:

    StackOverflowException: The requested operation caused a stack overflow.
    CodeStage.AdvancedFPSCounter.CountersData.StaticCounterData.Activate () (at Assets/Plugins/CodeStage/AdvancedFPSCounter/Runtime/Scripts/CountersData/Abstract/StaticCounterData.cs:13)
    CodeStage.AdvancedFPSCounter.CountersData.DeviceInfoCounterData.UpdateValue (System.Boolean force) (at Assets/Plugins/CodeStage/AdvancedFPSCounter/Runtime/Scripts/CountersData/DeviceInfoCounterData.cs:366)..............................................
     
  6. Gleb_Palchin

    Gleb_Palchin

    Joined:
    Jan 7, 2016
    Posts:
    22
    Actually this is not all of the steps, also I had Addressables Package in this empty project.

    I tried to remove it and the error is gone. Thats strange!
     
  7. Gleb_Palchin

    Gleb_Palchin

    Joined:
    Jan 7, 2016
    Posts:
    22
    I installed the Addressables Package again and there is no more error o_Oo_Oo_O

    I will come back with details if I will run into this again....
     
    codestage likes this.
  8. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    @Gleb_Palchin thank you for reporting this problem, I'll take a look on my side anyways as well and will get back with results.
     
  9. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    @Gleb_Palchin just sent a 1.4.7 fix for review, it should prevent such behavior in some usage scenarios, thank you for reporting once again!
     
    Gleb_Palchin likes this.
  10. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,209
  11. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey @adamz, yes it does works in VR, just needs correct positioning and adjustment to be close enough to the Camera if you like to snap it.

    Feel free to take a look at the Examples\VRExampleScene.unity and Examples\Prefabs\VR Example.prefab for the basic setup example.
     
  12. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey everyone!

    I'm glad to let you know Advanced FPS Counter 2.0 production is in a full throttle, and I'm crafting something special for you this time: Profiler Counter module for Unity 2020.2 and newer!

    After almost 6 years of free support and updates for the AFPSCounter, I'm about to release this feature as part of the paid 2.0 upgrade. It will be 50% off for all existing customers and 1 year of free updates grace period (you'll get an upgrade for free if you've purchased v1 within a year prior to v2 release).

    With this module, you'll be able to visualize any Profiler Stat as easy as any other currently existing Counter:

    gif.gif

    While most of Profiler Stats are available in Development Builds only, there are some crucial stats available at the release builds:

    2021.10.28_Twitter.png

    Those available for release builds are filtered and easily accessible when adding new item to the Stats list.

    It's still under construction and both UI and functionality are the subjects for the following changes, so please feel free to leave any early feedback of this feature and stay tuned for more updates as it'll pass closer to the public Beta!
     
    schmosef and MartinTilo like this.
  13. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,209
    Awesome! Will this also have VR support?
     
    codestage likes this.
  14. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Yes, v1 already works in VR without a problem and it will stay the same for the v2 with new Profiler Counter module as well as it'll share same underlying rendering engine used for other existing counters!
     
    DigitalAdam likes this.
  15. greatUnityGamer

    greatUnityGamer

    Joined:
    Aug 11, 2013
    Posts:
    182
    HI your AdvancedFPS sounds great and i bought it but it doesn't appear in my screen no matter what. I use HDRP i wonder if that is the problem. And i use Unity 2021.1.21f Can you help?
     
  16. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey, thanks for reporting this!

    Could you please confirm it does reproduces for you in the ExampleScene?

    Just to follow up, this is now resolved via direct email support.
     
    Last edited: Dec 14, 2021
    schmosef likes this.
  17. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Hi, did you learn any more about this? I'm using AFPS in a new project, and in a release build, AFPS says 2.5gb for memory, whereas Task Manager says 6.5gb. I am pretty sure that Task Manager is correct (tons of stuff in the scene, planning to do additive scene streaming), but it would sure be helpful if I could rely on the AFPS readout....
     
  18. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hi @gecko ,

    Thank you for following up on this.

    AFPSCounter uses Profiler.GetTotalReservedMemoryLong under the hood to get the Total memory readout for the Memory Counter.

    I was not able to reproduce it back then (and it seems you couldn't reproduce it too when I asked in the PM) so the ticket with QA (1148365) was closed as not reproduced.

    Please submit a new Bug report to Unity with your reproduction case, that would help get
    GetTotalReservedMemoryLong
    fixed to match the Task Manager readouts.

    It's worth checking what Unity Profiler shows for the running player and if its memory values do match the Task Manager.
    If values in Profiler are looking correct, it's worth asking QA why they do not match the
    GetTotalReservedMemoryLong
    API.

    AFPSCounter 2.0 with new Profiler Counter (Unity 2020.2+ required) allows rendering Profiler Markers and Counters. It could help to work around broken GetTotalReservedMemoryLong, but it's not released yet (I'm on the docs rn). Please let me know if you would like to participate in early beta.
     
  19. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I just did a dev build, and the Profiler says this for memory usage:

    Used Total: 7.85 GB Unity: 2.33 GB Mono: 0.85 GB GfxDriver: 4.54 GB Audio: 66.4 MB Video: 0 B Profiler: 75.1 MB
    Reserved Total: 8.31 GB Unity: 2.64 GB Mono: 0.99 GB GfxDriver: 4.54 GB Audio: 66.4 MB Video: 0 B Profiler: 79.0 MB
    Total System Memory Usage: 10.99 GB

    In this dev build, AFPS has a new MEM GFX readout, which is 4644mb. So I guess this makes more sense now: the MEM TOTAL and MEM ALLOC are 2829 and 2494 respectively, and that roughly matches the Unity: 2.33gb readout in the profiler, and GFX accounts for all the rendered objects/textures...? I am 95% sure that MEM GFX didn't appear until I did a dev build. I'll do another regular build tomorrow to check that...it would be much preferable obviously to have GFX reported in any kind of build.
     
  20. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,455
    That is sadly a restriction of Unity's Memory Profiler backend for now. GFX Memory numbers are only available in Development builds.
     
    codestage likes this.
  21. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Yes GFX readout works in dev builds only as @MartinTilo kindly confirms (there is also a note about this at the Inspector).

    Looks like the
    GetTotalReservedMemoryLong
    (that's what you see in MEM TOTAL) doesn't include some portion of the reserved memory.

    Still, Profiler Counter allows getting right values using
    System Used Memory
    counter (Stat) (read more about available Memory Counters and their description here).

    According to the docs, it can be 0 on some platforms which do not support getting system memory.

    Inspector:
    upload_2022-4-8_13-3-6.png

    Dev build (note the
    MEM SYS
    stat):
    upload_2022-4-8_13-3-43.png

    Process Explorer:
    upload_2022-4-8_13-4-57.png

    And for the non-dev build with same settings in inspector:
    upload_2022-4-8_13-10-40.png
    upload_2022-4-8_13-12-1.png

    While still not 100% match with numbers at the Process Explorer, it seems to be much closer to what you're looking for @gecko, comparing to what we see at the
    GetTotalReservedMemoryLong
    .

    Also, note how similar are numbers from
    GetTotalReservedMemoryLong
    (yellow MEM TOTAL) and
    Total Reserved Memory
    stat (blue MEM TOTAL). Still wonder why they are different, perhaps due to the different backing code.

    Looks like we need the
    Profiler.GetSystemUsedMemoryLong
    API to match the available memory counters =D

    More likely I'll deprecate "regular" Memory Counter in favor of a new Profiler Counter instance, configured to display new memory counters in future updates.
     
  22. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Ok, thanks for all that info. The only thing that confuses me now is why for me (Unity 2019.4.34, with AFPS v1.5.0), the AFSP inspector only says Unity 2018 required for GfxDriver, no mention of Dev build:

    upload_2022-4-8_8-32-14.png
     
  23. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Ah sorry, I've must be changed it in the v2.
     
  24. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    When is v2 coming out?
     
  25. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Working on this!

    Feature-wise it's ready, I'm now on polishing, docs and media.

    There is no specific date for release, but you can participate in Beta if you wish to try it early and provide a feedback.

    Feel free to PM me for details if you're interested.
     
    hoshos, schmosef and tosiabunio like this.
  26. GalShaffir1

    GalShaffir1

    Joined:
    Mar 3, 2022
    Posts:
    4
    Hello!
    I would like to monitor the gpu performance in my unity scenes and use the stats in other scripts (in order to show diffrence between performances in a table). can the fps counter help me with this?
     
  27. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    You can access all counters from the code, please take a look at the API docs to know more about available options.
    In the currently released version there are no gpu-specific counters available except the Render one.
    You can access GPU Profiler readouts at the current dev version which isn't released yet but accessible per request. Drop me a line with your invoice if you would like to give it a spin prior to the release, and I'll send it to you to try out.
     
  28. drewdough

    drewdough

    Joined:
    Oct 5, 2016
    Posts:
    57
    hi @codestage , I am looking to use this tool for creating a frame time graph on screen, and also sending it via HTTP to a server so I can review logs on test devices. Does your asset support frame time graphics? It seems like it does from the screenshot but wanted to confirm. And I can modify the code to have it send a CSV file to my server for the purpose of monitoring test devices?
    thanks
     
  29. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hi @drewdough ,

    You can access all the data AFPSCounter displays including FPS and Milliseconds readouts to process this data on your own be it charts or requests for your server.

    Just take a look at the example scene where it shows how to access counters data.
    Please let me know if you still have any questions!
     
  30. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    I haven't checked the whole thread, so it could be a known issue. Advanced FPS Counter 1.5.0 in Unity 2022.2.11 outputs the following warning:
    Code (CSharp):
    1. Assets\Plugins\CodeStage\AdvancedFPSCounter\Runtime\Scripts\CountersData\DeviceInfoCounterData.cs(482,94): warning CS0618: 'Resolution.refreshRate' is obsolete: 'Resolution.refreshRate is obsolete. Use refreshRateRatio instead.'
     
  31. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hi, thank you, it's already fixed in the current v2 dev version and I see I need to back port it to the v1 meanwhile, will do it shortly!
     
    Peter77 likes this.
  32. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Aand it's done =)
     
    Peter77 likes this.
  33. daklab

    daklab

    Joined:
    Nov 24, 2013
    Posts:
    27
    @codestage I was on 1.4.7 and updated to 1.5.2, but I still get 0 for the
    AFPSCounter.Instance.fpsCounter.LastRenderValue
    . When I use Unity's stats it shows a non-zero value as expected. Is this a bug or am I doing something wrong?
    upload_2023-10-29_6-12-48.png
    upload_2023-10-29_6-12-44.png
     
  34. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hi @daklab

    Yeah it could be a bug actually, could you please provide a bit more info so I could try repro it?
    - what's your unity version?
    - does it reproduce both in the Editor and Runtime?
    - does it reproduce in a new project?

    Thanks!
     
  35. daklab

    daklab

    Joined:
    Nov 24, 2013
    Posts:
    27
    @codestage
    1. v2020.3.11f1
    2. Yes
    3. Yes. I had a light memory that when I upgraded to URP it stopped working. I just created two new projects (one in default 3D and the other in 3D URP). URP seems to have the bug as the normal 3D project template worked as expected. Does that give you a good idea of where the issue likely is?
     
    codestage likes this.
  36. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Thanks for the information, yeah looks like I have some idea what could go wrong with it, will take a look!
     
    daklab likes this.
  37. daklab

    daklab

    Joined:
    Nov 24, 2013
    Posts:
    27
    @codestage Any update?
     
  38. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Yes, a new version with a fix is live in the store and should show rendering time for the modern Rendering Pipelines from now.
    I had to increment Unity version requirement up to the 2019.3 version.
    I'm using
    RenderPipelineManager.beginCameraRendering
    and
    RenderPipelineManager.endCameraRendering
    to calculate rendering time for the new pipelines.
     
    schmosef likes this.
  39. strich

    strich

    Joined:
    Aug 14, 2012
    Posts:
    374
    @codestage there is a serious nullref issue on consoles (xbox) with this plugin in AFPSInputProxy - All calls to Keyboard.current can and do return null. Can you fix this please?
     
    codestage likes this.
  40. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    Hey @strich thank you so much for bringing this to my attention!
    The fix is available in the store now, please let me know how does it work for you ^^
     
    Last edited: Jan 9, 2024
    John-G likes this.