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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:38:47+00:00 2026-05-26T03:38:47+00:00

Is there a general algorithm that address playback speed of a log file having

  • 0

Is there a general algorithm that address playback speed of a log file having the following properties. It would be nice to not have to read the whole log file as well, if possible.

  • Every line contains a timestamp
  • Sampling rate is unknown

The playback would then be able to be played at any speed 2x for example.

thought of a few different ways but thought there might be a generalized algorithm out there.

  1. read the first timestamp and use that to decide if the next line should be run yet, scheduler-esce.
  2. read all lines assigning a schedule into memory, then each line will fire at correct time. Again you have to read the first line to get a reference point.

thanks

  • 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-26T03:38:48+00:00Added an answer on May 26, 2026 at 3:38 am

    If the lines in the log file are in chronological order, then it’s pretty easy.

    1. Read the first line, save its time stamp, and execute it.
    2. Read the second line, compute the difference in times, adjust with the speed factor, and add that interval to the current time.
    3. The result is the time to execute the next command.
    4. Execute the command at the proper time and loop to step 2.

    So if you want to run at 2x:

    cmd = read_log
    previous_time = cmd.time;
    while (true)
    {
        new_time = cmd.time;
        execute_time = current_time + (new_time - previous_time)/2.0;
        previous_time = new_time;
        // wait here until it's time to execute the command
        execute_command();
        cmd = read_log
    }
    

    That’s the single-threaded way to do it. I would suggest, though, using two threads: one to read the log and queue commands, and another to read the queue and execute commands.

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

Sidebar

Related Questions

I would like to know if there are general rules for creating an index
There is a general rule of OO design that you should model is-a relationships
Is there an algorithm that checks whether creating a new thread pays off performance
Suppose a general sliding algorithm that executes some function on a kernel, like a
Are there any general heuristics, tips, tricks, or common design paradigms that can be
I would like to understand the general way of doing the following on a
Background With respect to cryptography in general, the following advice is so common that
Is there a general procedure for programming extensibility capability into your code? I am
Is there a general rule of thumb to follow when storing web application data
Is there a general rule of thumb as to how many classes, interfaces etc

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.