I've learned. I'll share.

October 14, 2008

How to DTrace Python in OSX

DTrace is an incredible tool. It basically lets you do profiling of a live application with no performance penatly. I'm writing a Python that needed some profiling, and I found the "normal" techniques like the profile/cProfile module very lacking. Luckily, Mac OSX comes with DTrace and it even works with Python. The only snag is that it's hard to find how to use the darn thing. I finally figured it out, so I figured it pass on the knowledge.

So, here's how you use dtrace on your python application in Mac OSX:

  1. Get DTraceToolkit.
  2. Edit Python/py_cputime.d by replacing "function-entry" with "entry" and "function-return" with "exit".
  3. Call "sudo dtrace -s Python/py_cputime.d"
  4. Let it sit there a while and hit ctrl-c.
  5. Enjoy the results

I can only assume you have to edit the file because of some difference between Solaris and OSX. You can try files other than py_cputime.d, but you might have to edit them too. Not all of them work, but most do.

The last thing to know is that you have to use the python that comes with OSX. A custom-built python doesn't seem to work.

Hope that helps!

41 comments:

  1. Hi,

    this looks interesting but I can't make it work - I just get "dtrace: no probes specified". I tried passing a python script as an argument, but nothing happens - anything I'm missing?

    ReplyDelete
    Replies
    1. I am glad that I saw this post. It is informative blog for us and we need this type of blog thanks for share this blog, Keep posting such instructional blogs and I am looking forward for your future posts. Python Projects for Students Data analytics is the study of dissecting crude data so as to make decisions about that data. Data analytics advances and procedures are generally utilized in business ventures to empower associations to settle on progressively Python Training in Chennai educated business choices. In the present worldwide commercial center, it isn't sufficient to assemble data and do the math; you should realize how to apply that data to genuine situations such that will affect conduct. In the program you will initially gain proficiency with the specialized skills, including R and Python dialects most usually utilized in data analytics programming and usage; Python Training in Chennai at that point center around the commonsense application, in view of genuine business issues in a scope of industry segments, for example, wellbeing, promoting and account. Project Center in Chennai

      Delete
  2. It appears that you no longer need to edit py_cputime.d under Snow Leopard...

    ReplyDelete
  3. Hmmm
    dtrace: error on enabled probe ID 7 (ID 26198: python47:Python:PyEval_EvalFrameEx:function-return): invalid address

    ReplyDelete
  4. Quickbooks is the advanced accounting software to manage business-related data. QB tool Hub is the hub of all essential tools which are used to diagnose common errors while accessing Quickbooks. You can fix minor or major issues like performance issues, PDF issues, Printing issues, and network connectivity problems.
    Quickbooks tool hub download

    ReplyDelete
  5. CellAlpha is a One-Stop Platform where you can find genuine reviews. and free books, podcast, many more things

    ReplyDelete
  6. Really this article is very useful and informative for everyone. And I hope you'll share more ideas and useful article with us, also visit Best Wrist Wraps

    ReplyDelete
  7. Hi thank for sharing such a nice post on your blog keep it up and share more. also know most efficient propane generator

    ReplyDelete
  8. Hello friend,
    I recently joined your post , I found its very informative and knowledgeable . I am very impressed. Thanks for sharing this post. Keep posting more.

    Also read: android mod download

    ReplyDelete
  9. Hello Friend,
    I just now only saw your post , I found its very knowledgeable and more informative. I am very impressed. Thanks for sharing this post. Keep posting more post.

    Also read: fitnessvote.com

    ReplyDelete
  10. Hello Buddy,

    I am recently followed your post. It was very unique compare to others. I am very impressed to saw your post. I am got many information. Thank you for sharing your knowledge here. My knowledge was grown up to read your post.

    Also read: govt naukri

    ReplyDelete
  11. Hello mate,
    I am saw your post , I found its very knowledgeable and more informative. I am very impressed. Thanks for sharing this post. Keep posting more post.

    Also read: VPS free trial




    ReplyDelete
  12. Aspirants can apply online application form for current Railways job vacancies across India. To get free job notifications for RRB, RRC, Rapid Metro, and Various Other Railway Posts Freshers and Experienced candidates can subscriber to our website.govt naukri

    ReplyDelete


  13. Hello Buddy,

    I am recently addicted your post. It was very unique compare to others. I am very impressed to saw your post. I am got many information. My knowledge was grown up to read your post. Thank you for sharing your knowledge here. keep doing many post.

    Also read: Download pubg lite for pc

    ReplyDelete
  14. Thanks for sharing this informative content.,
    Leanpitch provides online training in Scrum Master Certification during this lockdown period everyone can use it wisely.
    Join Leanpitch 2 Days CSM Certification Workshop in different cities.

    Scrum master certification online

    CSM certification online

    ReplyDelete
  15. Thanks for sharing this informative content.,
    Leanpitch provides online training in Scrum Master Certification during this lockdown period everyone can use it wisely.
    Join Leanpitch 2 Days CSM Certification Workshop in different cities.
    CSM online

    CSM online certification

    ReplyDelete

  16. Thanks for sharing this informative content.,
    Leanpitch provides online training in Scrum Master Certification during this lockdown period everyone can use it wisely.
    Join Leanpitch 2 Days CSM Certification Workshop in different cities.
    CSM online training

    CSM training online

    ReplyDelete
  17. Thanks for sharing this informative content.,
    Leanpitch provides online training in Scrum Master Certification during this lockdown period everyone can use it wisely.
    Join Leanpitch 2 Days CSM Certification Workshop in different cities.
    CSM training online

    Scrum master training online

    ReplyDelete

  18. Hello Dude,

    I am recently followed your post. It was very unique compare to others. I am very impressed to saw your post. I am got many information. My knowledge was grown up to read your post. Thank you for sharing your knowledge here. keep doing many post.

    Also read: See this

    ReplyDelete

  19. Hello Buddy,
    I saw your post. It was really nice . I found its highly informative and knowledgeable.Thanks for sharing this post. keep going.And post more.


    Also read: eetime.com

    ReplyDelete

  20. Hi mate,
    I am recently followed your post. It was very unique compare to others. I am very impressed to saw your post. I am got many information. My knowledge was grown up to read your post. Thank you for sharing your knowledge here. keep doing many post .

    also read : floor mats for vinyl floors in trucks

    ReplyDelete
  21. Hi Friend,

    Just now only i joined your post. It was very informative and more knowledgeable. Your post was very interesting. Thank you for sharing this type of post. keep posting more.

    also read : best divorce lawyers in bangalore

    ReplyDelete
  22. Hello Buddy,
    I saw your forum post. It was really nice . I found its highly informative and knowledgeable forum post.Thanks for sharing this forum post. keep going. And post more forums.
    Also read: Tek Patron

    ReplyDelete
  23. I am genuinely delighted to read this weblog posts which carries tons of useful facts, thanks for providing these kinds of data. also check here Buying Guides for UK

    ReplyDelete
  24. I just couldn't leave your website before telling you that I truly enjoyed the top quality info you present to your visitors? Will be back again frequently to check up on new posts. Click Here. GAPPS for Lineage OS 17.1

    ReplyDelete
  25. We at Top Review Experts help people to find the best product in UK. We provide best quality product reviews of different things. Checkout Best Product Reviews and Best Buying Guides.

    ReplyDelete

  26. Uttar Pradesh Government provides jobs for 08th Pass, 10th Pass, 12th Pass, Graduates, Engineers, etc. The job seekers who meet the recruitment board's eligibility criteria can apply for the UP Govt recruitments from here.
    also read : free job alert up

    ReplyDelete
  27. I am glad that I saw this post. It is an informative blog for us and we need this type of blog thanks for share this blog, Keep posting such instructional blogs and I am looking forward to your future posts. Also, visit Gastrointestinal Drugs Manufacturers

    ReplyDelete
  28. Quickbooks error code 6123 0 is a difficult error that occurs when using the application to manage day-to-day accounting processes. QuickBooks is without a doubt one of the most popular accounting software among CPAs, business owners, and solo entrepreneurs. Accounting software's features and functions can assist you in streamlining your business process and increasing profitability.

    ReplyDelete
  29. hy Its very well written and very knowledgeable and attractive so that I get to learn something new quickbooks connection diagnostic tool A dialogue box for installation will display.By clicking the I agree button, you agree to the terms and conditions. Press the Next button later.Simply follow the on-screen instructions to complete the installation.

    ReplyDelete
  30. Your blogs are great.Are you also searching for nursing pico writing help? we are the best solution for you. We are best known for delivering nursing writing services to students without having to break the bank.

    ReplyDelete
  31. Hi, I am James Aultman, I am working as a tech expert at QuickBooks support. I have 3 years of experience in this field. you have any problems related to QuickBooks Error 6155 0, then please contact our expert team of Asquare Cloud hosting at 855-856-0053.

    ReplyDelete
  32. If some one wants expert view on the topic of blogging
    and site-building then i recommend him/her to go to see this web site,
    Keep up the good work.


    스포츠토토티비
    스포츠중계
    토토사이트

    ReplyDelete
  33. I have been browsing online greater than three hours lately, yet I by no means discovered any interesting article like yours. It is pretty price sufficient for me. In my opinion, if all website owners and bloggers made good content material as you probably did, the internet will be a lot more useful than ever before.


    토토
    프로토
    토토게임

    ReplyDelete
  34. You present a very well-written article and with some awesome information which is very helpful, like me as reader. Thanks for sharing it and also
    please visit our great site below.

    바카라사이트
    바카라
    바카라게임사이트

    ReplyDelete
  35. If you need home decor or office decor then make sure to visit zvasti

    ReplyDelete
  36. Nice Post. I have been reading here for about an hour. I am a newbie and your success is very much an inspiration for me. If you want to Recover Forgot Spectrum Email Password please contact our team for instant help.

    ReplyDelete

Blog Archive

Google Analytics