Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 722113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:57:06+00:00 2026-05-14T05:57:06+00:00

I have developed a python C-extension that receives data from python and compute some

  • 0

I have developed a python C-extension that receives data from python and compute some cpu intensive calculations.
It’s possible to profile the C-extension?

The problem here is that writing a sample test in C to be profiled would be challenging because the code rely on particular inputs and data structures (generated by python control code).

Do you have any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:57:06+00:00Added an answer on May 14, 2026 at 5:57 am

    I’ve found my way using google-perftools. The trick was to wrap the functions StartProfiler and StopProfiler in python (throught cython in my case).

    To profile the C extension is sufficient to wrap the python code inside the StartProfiler and StopProfiler calls.

    from google_perftools_wrapped import StartProfiler, StopProfiler
    import c_extension # extension to profile c_extension.so
    
    StartProfiler("output.prof")
    ... calling the interesting functions from the C extension module ...
    StopProfiler()
    

    Then to analyze for example you can export in callgrind format and see the result in kcachegrind:

    pprof --callgrind c_extension.so output.prof > output.callgrind 
    kcachegrind output.callgrind
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a GUI that is used to extract some data from a
I have an application(developed in python) that requires a refreshed view from the datastore
I have developed a web site that requires user registration and authentication for some
I have developed a Java server using Eclipse that accepts TCP socket connection from
I have some code I developed in python 2.4++ and you bet, I have
I have developed some code in Python using the eclipse perspective PyDev. The code
I have developed some internal tools at work using Python. I have been using
I have a system (developed in Python) that accepts datetime as string in VARIOUS
Most python frameworks will have a development webserver of some kind that will have
I have developed a few python programs that I want to make available online.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.