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 8648169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:15:08+00:00 2026-06-12T13:15:08+00:00

When trying to log/debug an ISR, I’ve seen: 1) sprintf() used as example in

  • 0

When trying to log/debug an ISR, I’ve seen:

1) sprintf() used as example in ‘O’Reilly Linux Device Drivers’

irqreturn_t short_interrupt(int irq, void *dev_id, struct pt_regs *regs)

{

    struct timeval tv;
    int written;

    do_gettimeofday(&tv);


    /* Write a 16 byte record. Assume PAGE_SIZE is a multiple of 16 */

    written = sprintf((char *)short_head,"%08u.%06u\n",

            (int)(tv.tv_sec % 100000000), (int)(tv.tv_usec));

    BUG_ON(written != 16);

    short_incr_bp(&short_head, written);

    wake_up_interruptible(&short_queue); /* awake any reading process */

    return IRQ_HANDLED;

}

unlike printf(), sprintf() write to memory instead of to console, and does not seem to have re-entrant or blocking issue, correct? but I’ve seen words against sprintf() on other forum. I am not sure if it’s only because of its performance overhead, or else?

2) printk() is another one i’ve seen people used but blamed for, again performance issue (maybe nothing else?)

What is a generally good method/function to use when logging, or debugging ISR in Linux these days?

  • 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-12T13:15:09+00:00Added an answer on June 12, 2026 at 1:15 pm

    Regarding sprintf(). Do the search in any LXR site, for example here:

    Freetext search: sprintf (4096 estimated hits)
    drivers/video/mbx/mbxdebugfs.c, line 100 (100%)
    drivers/isdn/hisax/q931.c, line 1207 (100%)
    drivers/scsi/aic7xxx_old/aic7xxx_proc.c, line 141
    

    I think this eliminates any doubts.

    As for printk(), printk.h says:

    /* If you are writing a driver, please use dev_dbg instead */

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

Sidebar

Related Questions

I am trying log some entries in a log file (Log.Trace / Log.Debug) while
I am trying to create simple Chrome console wrapper: function debug() { console.log(debug.arguments); }
I'm trying to log all DEBUG messages to console during testing in maven. For
Im trying to log my tests output to a file as well as running
I am trying to log into google reader using AfNetworking AfHttpClient but I am
I am trying to log the input/output of expect to an open file. The
I'm trying to log into a site and obtain the code back, but i'm
I am trying to log into a website, then go to a link and
I am trying to log some input values into an array via jquery and
I'm trying to log everything that happens in my application to two logs: one

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.