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
0
Question by mayankgrover · Aug 20, 2013 at 08:41 PM · performancememory usagecpu usage

Tracking cpu usage and memory for Web Player

Hi, Currently I am working on a game for the web player, a MMO so I would like to be able to track cpu usage and memory (free/used/etc..) and log it. I was trying to use PerformanceCounter as we use that on our server end for the same purposes but this class is not compatible with the Webplayer (per http://docs.unity3d.com/410/Documentation/ScriptReference/MonoCompatibility.html).

So I want to know if there is an existing API which can help in capturing this information on the client side? (This would be process level information i would assume)

Thanks.

Comment
Add comment · Show 5
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 Ejlersen · Aug 20, 2013 at 08:49 PM 0
Share

Hm, I'm not sure if its even possible given that a webplayer has restricted access to the system.

avatar image mayankgrover · Aug 20, 2013 at 09:08 PM 0
Share

But shouldn't it be possible to get some sort of access to current system resources that the process is consu$$anonymous$$g?

avatar image Ejlersen · Aug 21, 2013 at 06:10 PM 0
Share

I just tried using Process to calculate it, but its not available in webplayer builds.

It would be nice to have that form of access, but it might be because of security that they have set a strict access to any part of the system.

avatar image mayankgrover · Aug 21, 2013 at 06:27 PM 0
Share

@Ejlersen thanks.

Profiler can access a dev build of the game running in the web player, shouldn't there be some way of accessing it? (I couldn't find any resource on how the profiler does this)

avatar image Ejlersen · Aug 22, 2013 at 07:12 PM 0
Share

You are right... Hm, might have an answer for you. Give me a $$anonymous$$ute.

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Ejlersen · Aug 22, 2013 at 07:16 PM

Okay, might have something you can use:

 GUILayout.Label("Total Allocated: " + Profiler.GetTotalAllocatedMemory());
 GUILayout.Label("Total Reserved: " + Profiler.GetTotalReservedMemory());
 GUILayout.Label("Total Reserved Unused: " + Profiler.GetTotalUnusedReservedMemory());
 GUILayout.Label("Mono Heap: " + Profiler.GetMonoHeapSize());
 GUILayout.Label("Mono Used: " + Profiler.GetMonoUsedSize());

Looks like the first three works fine in Webplayer.

Comment
Add comment · Show 2 · 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
avatar image mayankgrover · Aug 23, 2013 at 08:24 PM 0
Share

thanks @Ejlersen that works. although its quite an expensive call and pretty much hangs the game for a good couple of seconds at least.

Profiler API does not have anything for tracking current CPU usage which is strange.

avatar image Ejlersen · Aug 25, 2013 at 09:18 PM 0
Share

Well, Unity's profiler doesn't really track cpu usage, but it tracks how much time everything takes. You could probably get it to do that, but that's really expensive.

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

16 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

Related Questions

PerformanceCounters return 0MB RAM and %100 CPU in Unity 0 Answers

Huge "other" in Gpu Profile ! 4 Answers

Unity is performing 2x better on weaker macbook than on beast PC -- what should I look for as the reason for this? 2 Answers

After 3-5 seconds overhead spikes and keeps taking up +60% of performance 2 Answers

Render Transparent Geometry takes high CPU and low fps 1 Answer


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