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

  • Home
  • SEARCH
  • 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 8301177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:50:51+00:00 2026-06-08T16:50:51+00:00

I wrote a daemon using the python-daemon library. And it uses about 20% of

  • 0

I wrote a daemon using the python-daemon library. And it uses about 20% of CPU all the time. Can I somehow check which part of the program uses all this CPU time cause well it actually just waits for userinput? Help is as always much appreciated!

My daemon is started:

python file1:

context = daemon.DaemonContext()
context.pidfile = PidFile(pidfile)
with context:
    module.run()

python file2:

def run():
    end = threading.Event()
    # Do something here then:
    try:
        while not end.isSet():
        # Do some more stuff

    except KeyboardInterrupt, SystemExit:
        pass
    # Except some more stuff 

** EDIT

Maybe you could help me again, now I ran a profiler but can’t really tell who the “baddie” is. Here is my profile results

  • 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-06-08T16:50:54+00:00Added an answer on June 8, 2026 at 4:50 pm

    You can attach a Python profiler to your software:

    http://docs.python.org/library/profile.html

    … and make the profiler start when the daemon is started. Then let the profiler collect profiling information a while and use a signal sent to process (e.g. SIGUSR1) to make your deamon to dump the profiling data to a file.

    http://docs.python.org/library/signal.html

    …or alternative write profiling log when the process exits at atexit handler.

    Then you can read this file and see which function has most cumulative CPU usage.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a simple script using python-daemon which prints to sys.stdout : #!/usr/bin/env python
I wrote a simple test daemon using Proc::Daemon . Here is the daemon: #!/usr/bin/perl
I'm trying to write a daemon process using code igniter library, and the problem
I wrote this script to find all files/directories to which $WWWUSER has write permissions.
I'm using a daemon-script which is monitoring a remote server. When the remote server
I have wrote a python daemon for read a database... I do the next:
I wrote a daemon which was structured like this: while( true ) { //
I'm using the xmpppy library to write an XMPP client that can chat with
I wrote a small Python application that runs as a daemon. It utilizes threading
I wrote a little daemon in Perl that calls up FFMpeg to encode a

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.