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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:40:42+00:00 2026-05-31T06:40:42+00:00

I am trying to gather data from multiple sources on an Ubuntu 10.10 machine

  • 0

I am trying to gather data from multiple sources on an Ubuntu 10.10 machine programatically about a program’s performance. For all of my other sources, I have been able to gather them using the RDTSC x86 instruction, and then scale them using gettimeofday to convert to seconds in absolute time. When I start trying to coordinate these data sources with the output of doing sched_switch tracing in /sys/kernel/debug/tracing, however, I run into an issue, since the output I am seeing is in seconds and microseconds since some unknown time.

Steps I have already done:
1. I’ve determined that the Linux kernel internally also uses RDTSC, but adds some offset which it gathers, but I don’t seem to have ability to retrieve. It does this on a per-core basis as well, which means I would have to try all four cores and determine the best one, which seems like a poor solution to this problem.
2. I’ve tried converting RDTSC times around turning on logging, to see if at least the conversion itself is consistent (i.e. some constant offset), but the scale doesn’t seem to stay constant throughout the run.
3. clock_gettime(CLOCK_MONOTONIC, …) seems to have a very similar value, but is always off by an unexceptable amount (around half a second), and doesn’t seem entirely consistent either.

If I am able to change how my other data sources gather their time to whatever is needed (assuming it isn’t performance intensive), how should I gather times in order to coordinate between trace’s time and the times I am gathering? Is there some sort of way to change the output to RDTSC, so I can just use that, or is there a system call I can make to get the same time as what is being output to trace? Thanks in advance for any help.

  • 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-31T06:40:43+00:00Added an answer on May 31, 2026 at 6:40 am

    So after looking at the source code, I found that at one point, the code takes the RDTSC value, and does some fancy math with it to try to multiply it by the clock frequency and add some offset that is calculated on boot up. This code seems to be a bit outdated, however, since RDTSC is guaranteed to be consistent across cores on newer chips, while this assumes each one is different. It also seemed to be gathering the current frequency instead of the max frequency, which is what the documentation seems to state that RDTSC uses.

    Thus, at this point it seems that the time isn’t directly relateable to actual time at an accuracy level that is useful in my instance. Hopefully this bug is fixed in an upcoming kernel release to fix this, and open up the opportunity for me to synchronize these two sets, but until then, it doesn’t seem reliable enough.

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

Sidebar

Related Questions

I am trying to achieve an LDAP query to gather all properties we have
I am trying to gather data from twitter and visualize it through Graphviz. I
Trying to figure out a way where I can pass some data/fields from a
I'm trying to gather Twitter statistics from a specific dataset that was provided to
I am trying to use WMI to gather system data which in this case
I have a client that I'm trying to do some data migration out of
I'm trying to write an SQL query that will gather certain data in one
I have an existing recordset that retrieves all the information from a table in
I am trying to gather a list (array) of ids in a sector <div
I need to gather some statistics in my software and i am trying to

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.