Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by metaleap · Aug 14, 2013 at 07:59 AM · fpsframerategpuprofilingmeasure

How to measure frame time (not FPS, but CPU+GPU ms/frame) regardless of vsync?

Wall of text, but really the question is in the title ;)

Some (or most) Android devices have a hard framerate cap. One of my HTC is capped at 30 fps, another at 60 fps, and disabling vsync in Unity (whether quality settings or from script) does not help there:

For continuous on-device performance monitoring during development (testing out the impact of game additions over time), it would be essential to measure (or "plausibly estimate") time taken per frame, CPU-side and GPU-side, even when the typical simplistic FPS metric would be still be at par or higher than the hard cap:

Currently, for a near-empty Unity scene (hence very high render performance) on a device with an enforced hard vsync (that sadly cannot be disabled via Unity project settings or scripts), a simple FPS measurement script would only report a constant 30 or 60 FPS. But that doesn't help analyze for example whether a newly added shader or script adds a heavy 5ms to frame time if we're still within budget "until it's too late": ie. this will only become noticeable once the whole setup later on drops under the device's hard vsync --- by that time we have too much new stuff going on and would have to dive into the whole messiness of profiling (if we're even on Unity Pro), debug builds etc.

Of course it's really hard to measure whole frame time (including GPU time) with vsync enforced:

  • measuring CPU-side frame time is fairly easy by sensibly picking the proper methods to track approximate startTime of frame (OnUpdate) and endTime of frame (via WaitForEndOfFrame)

  • but alas most of the time we might be GPU-bound!

I guess if I want to avoid profiling/debugging I'll need to figure out a way to force vsync-disabled somehow on unrooted Androids...

But maybe someone else another sneaky hacky idea to at least produce reasonably realistic guesstimates under imperfect measuring conditions?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image jashan · Jul 03, 2015 at 04:04 PM 0
Share

Just wanted to add that I'd also be very interested in this. Basically, what I'd need is the "wait time" when VSync is activated.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by jbelmonte · Aug 28, 2017 at 06:25 PM

This plugin gives app access to GPU time (works with Android for some GPU's):

https://github.com/google/render-timing-for-unity

Regarding CPU time measurement, the OnUpdate to WaitForEndOfFrame is a good start, but note that in VR mode Unity appears to place the GPU wait in the middle of that time (observed on Android Daydream and OpenVR). It's possible to deduct the wait in VR as roughly LateUpdate until Cavas.willRenderCanvases. You heard it here first.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

GPU usage and FPS have suddenly dropped significantly for my project and several others that I've tested 0 Answers

How do I get the render thread (GPU) ms from c# script 0 Answers

Windows UPS (update per seconds) always capped to 65 (Windows 7 or XP, Nvidia or ATI) 3 Answers

Problems with player movement at higher frame rates (Time.deltaTime not producing consistent results) 1 Answer

Low FPS with no shown reason 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges