This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Dhrystone Testing on Cortex A9: disabling Prints increases the DMIPS.

i am seeing an issue while doing Dhrystone test. i am using Dhrstone source code of version 2.1.

when i run this source code on LINUX platform, i got DMIPS/MHz =1.6

but there are some printing commands that prints variables used, when i disable them i got DMIPS/MHz=1.8

but these printing commands are after taking END TIME Measurements. but why so these are affecting the TIME measurement.

these are print commands

printf ("Final values of the variables used in the benchmark:\n");

  printf ("\n");

  printf ("Int_Glob:            %d\n", Int_Glob);

  printf ("        should be:   %d\n", 5);

  printf ("Bool_Glob:           %d\n", Bool_Glob);

  printf ("        should be:   %d\n", 1);

  printf ("Ch_1_Glob:           %c\n", Ch_1_Glob);

  printf ("        should be:   %c\n", 'A');

  printf ("Ch_2_Glob:           %c\n", Ch_2_Glob);

  printf ("        should be:   %c\n", 'B');

  printf ("Arr_1_Glob[8]:       %d\n", Arr_1_Glob[8]);

  printf ("        should be:   %d\n", 7);

  printf ("Arr_2_Glob[8][7]:    %d\n", Arr_2_Glob[8][7]);

  printf ("        should be:   Number_Of_Runs + 10\n");

  printf ("Ptr_Glob->\n");

  printf ("  Ptr_Comp:          %d\n", (int) Ptr_Glob->Ptr_Comp);

  printf ("        should be:   (implementation-dependent)\n");

  printf ("  Discr:             %d\n", Ptr_Glob->Discr);

  printf ("        should be:   %d\n", 0);

  printf ("  Enum_Comp:         %d\n", Ptr_Glob->variant.var_1.Enum_Comp);

  printf ("        should be:   %d\n", 2);

  printf ("  Int_Comp:          %d\n", Ptr_Glob->variant.var_1.Int_Comp);

  printf ("        should be:   %d\n", 17);

  printf ("  Str_Comp:          %s\n", Ptr_Glob->variant.var_1.Str_Comp);

  printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");

  printf ("Next_Ptr_Glob->\n");

  printf ("  Ptr_Comp:          %d\n", (int) Next_Ptr_Glob->Ptr_Comp);

  printf ("        should be:   (implementation-dependent), same as above\n");

  printf ("  Discr:             %d\n", Next_Ptr_Glob->Discr);

  printf ("        should be:   %d\n", 0);

  printf ("  Enum_Comp:         %d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp);

  printf ("        should be:   %d\n", 1);

  printf ("  Int_Comp:          %d\n", Next_Ptr_Glob->variant.var_1.Int_Comp);

  printf ("        should be:   %d\n", 18);

  printf ("  Str_Comp:          %s\n",

                                Next_Ptr_Glob->variant.var_1.Str_Comp);

  printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");

  printf ("Int_1_Loc:           %d\n", Int_1_Loc);

  printf ("        should be:   %d\n", 5);

  printf ("Int_2_Loc:           %d\n", Int_2_Loc);

  printf ("        should be:   %d\n", 13);

  printf ("Int_3_Loc:           %d\n", Int_3_Loc);

  printf ("        should be:   %d\n", 7);

  printf ("Enum_Loc:            %d\n", Enum_Loc);

  printf ("        should be:   %d\n", 1);

  printf ("Str_1_Loc:           %s\n", Str_1_Loc);

  printf ("        should be:   DHRYSTONE PROGRAM, 1'ST STRING\n");

  printf ("Str_2_Loc:           %s\n", Str_2_Loc);

  printf ("        should be:   DHRYSTONE PROGRAM, 2'ND STRING\n");

  printf ("\n");

Parents
  • but these prints are after the time measurements. Dhrystone Code Flow is like this

    read the starting time

    main loop with 1 or more million iterations

    read the end time

    Prints variables

    then calculate total time take to execute main loop with above two timing parameters 



Reply
  • but these prints are after the time measurements. Dhrystone Code Flow is like this

    read the starting time

    main loop with 1 or more million iterations

    read the end time

    Prints variables

    then calculate total time take to execute main loop with above two timing parameters 



Children
  • Many of the variables in the loop may only be used in the printf calls. If you remove the printf then the variable is unused, and the compiler will (probably) remove the obsolete computation inside the loop too. As Martin said, check the dissembly to see what code the compiler actually generated and what changed.

    P