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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:37:43+00:00 2026-05-31T13:37:43+00:00

We have an assignment where we need to profile a ‘simple instruction’ (addition or

  • 0

We have an assignment where we need to profile a ‘simple instruction’ (addition or bit-wise and for example). This means performing the same operation a large number of times (100K+) and measuring the average time in microseconds. The result should be presented in cycle-lengths: (totalTime/iterations)*cphMHz.

So, results may vary but all in all we were told that we should get a result close to 1 cycle-length. Actual result doesn’t matter as long as programming is correct.

My question is: what is a good operation to profile?
There are two points I need to concider:

  1. I use loop unrolling to be a bit more accurate, so in each iteration I perform 10 simple instruction. This means I have to choose an operation to wouldn’t be performed only once due to compiler optimization (we can’t use -o0 flag as school staff does not).
    Bad example: var = i; – the compiler would only perform the last command.
  2. What is a real ‘simple instruction’? How do I know the number of operations that are actually performed? I tried reading the assembly output, but I couldn’t understand it.

Hope I was clear enough, any idea would be great.

Thanks anyway

P.S don’t know if it matters but I write in CPP

  • 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-31T13:37:44+00:00Added an answer on May 31, 2026 at 1:37 pm

    1) This sounds (to me) like an impossible task, if optimizations are (or might be) enabled. You can never be sure on what the compiler will do during optimizations. I’d definitely do something like reusing the previous result. If allowed to/possible, I’d try to include a raw assembler snippet to be profiled (so you can be sure there’s no additional overhead; although it still could be optimized).

    2) As for instructions: One assembler command is one instruction. E.g. a += i will – depending on available instruction set and stuff – most likely result in 4 instructions: read a, read i, add, write a. Reading assembly is pretty much straightforward. Depending on the instruction set/processor, there might be different “directions” for reading (i.e. “from -> to”). x86 assemblers (and those for most other common processors) will prefer instruction target, source, while DSPs prefer to use instruction source, target. Just important to know: moving data has to happen through registers. So even a single assignment like a = b will result in two instructions (b to register and register to a).

    In general, if this answer goes into the wrong direction, try to elaborate a bit more on your specific task and its requirements (e.g. which compiler is to be used) and drop me a short comment.

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

Sidebar

Related Questions

So I have this assignment : I need help with question 2. I thought
I have a homework assignment where I need to take input from a file
Hi I have a homework assignment where I need to implement an intersection of
Hello is have a question for a school assignment i need to : Read
I have an assignment in which I need to create a function that tells
I have this assignment due that requires the usage of FLTK. The code is
I have been given a homework assignment where I need to create a captcha
I have this homework assignment where the user is asked to input numbers and
I need little help on a homework assignment. I have to create a 10
I have a moderately simple assignment, to create a PHP/PDO site with login functionality

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.