• 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
1
Question by Foam · Nov 19, 2012 at 12:48 AM · profiler

How do I profile non-Unity code?

I am currently trying out the Profiler on the Pro version and am having some trouble.

Right now I do a ton of calculations in some (non-native) libraries before my scene loads and I can't seem to find where in the Profiler all of that info is being profiled, if it is. Of course, when the scene loads, I get all the profile information on a frame-by-frame basis, but I am not really interested in that. And the Profiler only seems to be showing Unity-specific info, as far as I can tell.

Am I missing something in the Profiler options or do I need to take my code out, write a test harness, and profiler it in a normal .NET profiler?

/edit Still no luck. I am attempting to Profile it using a .NET profiler in Windows but am having trouble getting the symbols hooked into the debugger. Perhaps because I generated the EXE in OSX and then moved it to Windows? In any case does the Unity profiler really only profile Unity specific code?

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by drastick · Nov 20, 2012 at 02:55 AM

I don't know what sort of built in options there are for Unity if there are any at all. I would write metrics tools into the non-native code. You should at least be able to see on a deep profile the metrics of functions that wrap your native code.

It sounds like you are just trying to get automated profiling tools to work, what about just adding your own custom metric tracking into your code that can be compiled in or out as needed? You might even be able to write an interface to the data that you can reflect back in a custom unity editor window.

Comment
Add comment · Show 1 · 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 Foam · Nov 27, 2012 at 11:36 PM 0
Share

Yes, I can wrap some timers around certain code. And I can move some code out that isn't using Unity specifically and write a harness around it and profile it externally.

I'm just confused as the Profiler documentation, what I can find, specifically states that Deep Profile will record all calls by the scripts, which doesn't seem to be the case.

It's strange---I moved out the heavy code into threads so that the profiler would be recording things as the calculations would be going on but it doesn't seem to have been picked up. Doubly strange, it DID pick up some of the $$anonymous$$ono calls but not from the threads. Everything seems to have been shuffled under "Overhead." I guess this is a side-effect of the fact that Unity can't be manipulated from threads?

I guess I could try attaching something like Redgate ANTS to a Unity process and see what it picks up.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

10 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

Related Questions

iPhone profiler shows strange values. 1 Answer

Deep profile generating error and not giving frame 1 0 Answers

iOS: Compressed audio not affecting memory? 2 Answers

perfHUD & Unity 0 Answers

Profiler Windows - What is "Others" 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