How to Measure How Many Results App Can Produce Per Second

Steve

I have one c++ app called IDCreator which takes two arguments for it to produce IDs. It prints its return value to the STDOUT ---- using printf ---- from where the Calling process fetches.

Now, I wonder how many IDs the IDCreator is able to produce per second (must be done outside this application), how can i achieve this? Is below code proper for doing such a job? there any other way?

string getid;
getid.append("./IDCreator arg1 arg2");

int count = 0;    
const int PERIOD = 100;

const int LEN = 512;
char buff[LEN] = {0};

time_t tick1 = time(NULL);
while(1)
{
     time_t tick2 = time(NULL);
     if ((tick2 - tick1) > PERIOD)
         break;

     FILE* res = popen(cmd.c_str(), "r");
     if (res)
     {
           fgets(res, buff, sizeof(buf));
           pclose(res);

           count++;
     }
}

printf("Products Per Second is: %d", count/PERIOD);
Nachiket Kate

Instead of creating a function which will indepedently measure the function time and doing that fancy/complex stuff, I would like to suggest a simple way.

  1. Add logger/timers at the start and end of your id generation module like,

    Do something

    logger.info(time)

    { id generation }

    logger.info(time)

    Do something

Loggers are for example purpose(generally easiest way to achieve timestamps) This will help you find time required to generate one id Based on this I hope time is in millis/micros (if its in micro then you need to use timers with microsecond granularity).

If you need x milliseconds to generate 1 id then you will generate round(1000/x) id's in a second. It's a simple equation.

  1. You can add loggers at the start and end of program and limit program to execute only for fix time duration (use logical breaking using timers or manual stop of program)

if in x seconds program generates y ids then, in 1 seconds program generates y/x ids

run the program 2-3 times for enough long duration to have average and accuracy to get throughput of your program.

I hope I was helpful.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to measure storm performance - tuples per second?

From Dev

How many attempts per second can a password cracker actually make?

From Dev

affdex-sdk. How many frames can processed per second?

From Dev

How to measure the number of messages produced by kafka producer per second?

From Java

How to measure http requests per second using micrometer

From Dev

how many is too many Kafka commits per second

From Java

How many interrupts does my cpu have per second?

From

Is it possible to limit how many goroutines run per second?

From Dev

How can I obtain statistics (requests per second, response time) for an app hosted on Cloud Foundry Pivotal?

From Dev

If I don't know how many times something will run per second, how can I get the same output?

From Dev

How can "new new Something" produce valid results in JavaScript?

From Java

How can you produce sharp paint results when rotating a BufferedImage?

From Dev

How can I force bitwise operators to produce unsigned results?

From Dev

How to calculate max requests per second of a Django app?

From Dev

How to measure compile time per object in CMake?

From Dev

How to measure time per layer in Chainer

From

How do I execute commands many many times per second in Golang?

From Dev

How to measure how many characters fit into a canvas?

From Java

How can I set while repeat count per second?

From Dev

How can i get save metric per second on prometheus?

From Dev

How can I run a macro multiple times per second in vba?

From Dev

How can I measure disk writes per file/program over a long period of time

From Dev

How many lookup columns we can create per list?

From Dev

How many times functions can be deployed per project?

From Dev

How many pods can be configured per deployment in kubernetes?

From Dev

How many schedulers can I create per application?

From Dev

How can I show more than 100 results per page?

From Dev

How can I divide two columns and show results per row?

From Dev

How to produce a snapshot table using Power BI measure

Related Related

  1. 1

    How to measure storm performance - tuples per second?

  2. 2

    How many attempts per second can a password cracker actually make?

  3. 3

    affdex-sdk. How many frames can processed per second?

  4. 4

    How to measure the number of messages produced by kafka producer per second?

  5. 5

    How to measure http requests per second using micrometer

  6. 6

    how many is too many Kafka commits per second

  7. 7

    How many interrupts does my cpu have per second?

  8. 8

    Is it possible to limit how many goroutines run per second?

  9. 9

    How can I obtain statistics (requests per second, response time) for an app hosted on Cloud Foundry Pivotal?

  10. 10

    If I don't know how many times something will run per second, how can I get the same output?

  11. 11

    How can "new new Something" produce valid results in JavaScript?

  12. 12

    How can you produce sharp paint results when rotating a BufferedImage?

  13. 13

    How can I force bitwise operators to produce unsigned results?

  14. 14

    How to calculate max requests per second of a Django app?

  15. 15

    How to measure compile time per object in CMake?

  16. 16

    How to measure time per layer in Chainer

  17. 17

    How do I execute commands many many times per second in Golang?

  18. 18

    How to measure how many characters fit into a canvas?

  19. 19

    How can I set while repeat count per second?

  20. 20

    How can i get save metric per second on prometheus?

  21. 21

    How can I run a macro multiple times per second in vba?

  22. 22

    How can I measure disk writes per file/program over a long period of time

  23. 23

    How many lookup columns we can create per list?

  24. 24

    How many times functions can be deployed per project?

  25. 25

    How many pods can be configured per deployment in kubernetes?

  26. 26

    How many schedulers can I create per application?

  27. 27

    How can I show more than 100 results per page?

  28. 28

    How can I divide two columns and show results per row?

  29. 29

    How to produce a snapshot table using Power BI measure

HotTag

Archive