How to count Number of Instructions executed in One Second

Discussion in 'C Programming' started by coaassign@gmail.com, Nov 10, 2007.

  1. Guest

    Hi all

    I need to get a count the no of instructions [ even assembly language
    instructions ] executed in a for loop in exactly one second...
    Can any one please give me the code for this...

    THANKS IN ADVANCE
     
    , Nov 10, 2007
    #1
    1. Advertising

  2. Guest

    On Nov 11, 12:12 am, "" <>
    wrote:
    > Hi all
    >
    > I need to get a count the no of instructions [ even assembly language
    > instructions ] executed in a for loop in exactly one second...
    > Can any one please give me the code for this...
    >
    > THANKS IN ADVANCE


    Please give me the code for this in C language....
     
    , Nov 10, 2007
    #2
    1. Advertising

  3. schrieb:

    > Please give me the code for this in C language....


    Your problem is not solvable by means the C language provides. It can
    (maybe) be solved by means your architecture provides (using inline
    assembly). But as this is architecture specific and you don't provide
    which architecture you're working on - lost cause.

    You don't even provide a name... so... lost cause anyways, I guess.

    Greetings,
    Johannes

    --
    "PS: Ein Realname wäre nett. Ich selbst nutze nur keinen, weil mich die
    meisten hier bereits mit Namen kennen." -- Markus Gronotte aka "Makus"
    aka "Kosst Amojan" aka "maqqusz" in de.sci.electronics
    <45608268$0$5719$-online.net>
     
    Johannes Bauer, Nov 10, 2007
    #3
  4. jacob navia Guest

    wrote:
    > Hi all
    >
    > I need to get a count the no of instructions [ even assembly language
    > instructions ] executed in a for loop in exactly one second...
    > Can any one please give me the code for this...
    >
    > THANKS IN ADVANCE
    >


    One method would be:

    1) Count the number of instructions in your loop by getting
    an assembly listing from the C compiler.
    2) Run the loop for 100 seconds.

    3) Divide.

    4) Done.





    --
    jacob navia
    jacob at jacob point remcomp point fr
    logiciels/informatique
    http://www.cs.virginia.edu/~lcc-win32
     
    jacob navia, Nov 10, 2007
    #4
  5. jacob navia Guest

    jacob navia wrote:
    > 2) Run the loop for 100 seconds.
    >
    > 3) Divide.
    >


    Well, that should be actually

    Run the loop 100 times!

    Sorry

    --
    jacob navia
    jacob at jacob point remcomp point fr
    logiciels/informatique
    http://www.cs.virginia.edu/~lcc-win32
     
    jacob navia, Nov 10, 2007
    #5
  6. jacob navia schrieb:

    > One method would be:
    >
    > 1) Count the number of instructions in your loop by getting
    > an assembly listing from the C compiler.


    This is with high likelyhood not the actual number of executed
    instructions, as on any modern operating system the sleeping process
    will be preempted and instructions will be executed by the
    scheduler/operating system/other tasks.

    It would be the correct count if the process had exclusive access to the
    CPU.

    In any case, the problem is poorly specified.

    Greetings,
    Johannes

    --
    "PS: Ein Realname wäre nett. Ich selbst nutze nur keinen, weil mich die
    meisten hier bereits mit Namen kennen." -- Markus Gronotte aka "Makus"
    aka "Kosst Amojan" aka "maqqusz" in de.sci.electronics
    <45608268$0$5719$-online.net>
     
    Johannes Bauer, Nov 10, 2007
    #6
  7. jacob navia Guest

    Johannes Bauer wrote:
    > jacob navia schrieb:
    >
    >> One method would be:
    >>
    >> 1) Count the number of instructions in your loop by getting
    >> an assembly listing from the C compiler.

    >
    > This is with high likelyhood not the actual number of executed
    > instructions, as on any modern operating system the sleeping process
    > will be preempted and instructions will be executed by the
    > scheduler/operating system/other tasks.
    >
    > It would be the correct count if the process had exclusive access to the
    > CPU.
    >
    > In any case, the problem is poorly specified.
    >
    > Greetings,
    > Johannes
    >


    Obvious. But I thought that the answer referred to the number
    of assembly instructions executed by the program...

    If the loop is short, the machine is lightly loaded, running 100
    loop executions could get below the task time slot and be
    executed without any task switch, but that is pure speculation.

    You are right that the problem is poorly specified.


    --
    jacob navia
    jacob at jacob point remcomp point fr
    logiciels/informatique
    http://www.cs.virginia.edu/~lcc-win32
     
    jacob navia, Nov 10, 2007
    #7
  8. santosh Guest

    On Saturday 10 Nov 2007 7:13 pm
    <> wrote in article
    <>:

    > On Nov 11, 12:12 am, "" <>
    > wrote:
    >> Hi all
    >>
    >> I need to get a count the no of instructions [ even assembly language
    >> instructions ] executed in a for loop in exactly one second...
    >> Can any one please give me the code for this...
    >>
    >> THANKS IN ADVANCE

    >
    > Please give me the code for this in C language....


    <OT>

    No need. Since you're (apparently) running under Linux just check the
    value for "BOGO MIPS" printed by the kernel as it boots up. Do 'dmesg |
    grep MIPS' to view it.

    </OT>
     
    santosh, Nov 11, 2007
    #8
  9. Guest

    On Nov 11, 12:12 am, "" <>
    wrote:
    > Hi all
    >
    > I need to get a count the no of instructions [ even assembly language
    > instructions ] executed in a for loop in exactly one second...
    > Can any one please give me the code for this...
    >
    > THANKS IN ADVANCE


    THE ACTUAL PROBLEM IS AS FOLLOWS.....

    Write a program (AND/OR manipulate) existing DOS program so as to
    count the number of

    instructions executed by the p4 processor in the IBM thinkcenter
    PC .You can

    show any instruction mix executed . Count the exact number of each
    distinct

    instruction in the total mix executed in one second .After
    demonstrating the setup &

    the count explain the counts thoroughly....

    THE ASSEMBLY INSTRUCTION MIX CAN BE ANYTHING....
     
    , Nov 11, 2007
    #9
  10. jacob navia Guest

    wrote:
    > On Nov 11, 12:12 am, "" <>
    > wrote:
    >> Hi all
    >>
    >> I need to get a count the no of instructions [ even assembly language
    >> instructions ] executed in a for loop in exactly one second...
    >> Can any one please give me the code for this...
    >>
    >> THANKS IN ADVANCE

    >
    > THE ACTUAL PROBLEM IS AS FOLLOWS.....
    >
    > Write a program (AND/OR manipulate) existing DOS program so as to
    > count the number of
    >
    > instructions executed by the p4 processor in the IBM thinkcenter
    > PC .You can
    >
    > show any instruction mix executed . Count the exact number of each
    > distinct
    >
    > instruction in the total mix executed in one second .After
    > demonstrating the setup &
    >
    > the count explain the counts thoroughly....
    >
    > THE ASSEMBLY INSTRUCTION MIX CAN BE ANYTHING....
    >


    I am sorry I told you anything. You should do your own homework!
    The purpose of homework is to make you learn the issues discussed
    in the lessons. If you cheat, you do not learn anything.

    Do not cheat.


    --
    jacob navia
    jacob at jacob point remcomp point fr
    logiciels/informatique
    http://www.cs.virginia.edu/~lcc-win32
     
    jacob navia, Nov 11, 2007
    #10
  11. "" <> writes:
    > On Nov 11, 12:12 am, "" <>
    > wrote:
    >> I need to get a count the no of instructions [ even assembly language
    >> instructions ] executed in a for loop in exactly one second...
    >> Can any one please give me the code for this...
    >>
    >> THANKS IN ADVANCE

    >
    > THE ACTUAL PROBLEM IS AS FOLLOWS.....
    >
    > Write a program (AND/OR manipulate) existing DOS program so as to
    > count the number of
    >
    > instructions executed by the p4 processor in the IBM thinkcenter
    > PC .You can
    >
    > show any instruction mix executed . Count the exact number of each
    > distinct
    >
    > instruction in the total mix executed in one second .After
    > demonstrating the setup &
    >
    > the count explain the counts thoroughly....
    >
    > THE ASSEMBLY INSTRUCTION MIX CAN BE ANYTHING....


    THE ACTUAL ANSWER IS AS FOLLOWS.....

    Do your own homework.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Looking for software development work in the San Diego area.
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Nov 11, 2007
    #11
  12. jacob navia schrieb:

    > I am sorry I told you anything. You should do your own homework!


    Totally seconded.

    Greetings,
    Johannes

    --
    "PS: Ein Realname wäre nett. Ich selbst nutze nur keinen, weil mich die
    meisten hier bereits mit Namen kennen." -- Markus Gronotte aka "Makus"
    aka "Kosst Amojan" aka "maqqusz" in de.sci.electronics
    <45608268$0$5719$-online.net>
     
    Johannes Bauer, Nov 11, 2007
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ben
    Replies:
    8
    Views:
    357
  2. Mack

    Count number of bits set in a number

    Mack, Sep 27, 2007, in forum: C Programming
    Replies:
    12
    Views:
    830
    Mark Bluemel
    Sep 28, 2007
  3. Replies:
    2
    Views:
    459
    Jerry Coffin
    Jan 14, 2008
  4. Larry
    Replies:
    5
    Views:
    801
    Bernard
    Mar 13, 2008
  5. yelipolok
    Replies:
    4
    Views:
    288
    John W. Krahn
    Jan 27, 2010
Loading...

Share This Page