home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / timer / c_timr20 / userfunc.c < prev   
Encoding:
C/C++ Source or Header  |  1992-06-10  |  3.8 KB  |  121 lines

  1. #include <stdio.h>
  2.  
  3. /******************************************************************************
  4. *
  5. * This is where you place the test function prototype, which can be called
  6. * whatever you like, as long as you make reference to it in function_call()
  7. * below.
  8. *
  9. * Alternatively, you may place the test function in a separately compiled
  10. * module, as long as you prototype it here and call it in function_call()
  11. * below.
  12. *
  13. ******************************************************************************/
  14.  
  15. void userfunc(unsigned int a, unsigned int b, unsigned int c);
  16.  
  17.  
  18.  
  19.  
  20.  
  21. /******************************************************************************
  22. *
  23. * These are just dummy variables for this example of userfunc(). They are not
  24. * necessary for your implementation.
  25. *
  26. ******************************************************************************/
  27.  
  28. unsigned int arg1;
  29. unsigned int arg2;
  30. unsigned int arg3;
  31.  
  32.  
  33.  
  34.  
  35.  
  36. /******************************************************************************
  37. *
  38. * setup_userfunc() - This function is called ONCE by c-timer.exe, prior to
  39. *                    beginning the timing procedure. It is passed the command
  40. *                    line (argc and argv) for you to make use of. Keep in mind
  41. *                    that argv[0] is the name of c-timer.exe, argv[1] is the
  42. *                    name of the test function (or other text string), and
  43. *                    argv[2] is the number of parameters to the test function.
  44. *                    If your function needs additional command line parameters,
  45. *                    read them here as argv[3] through argv[n].
  46. *
  47. *                    This sample function just prints out the command line.
  48. *                    If you have no need for a setup routine, you must still
  49. *                    provide this function, although it may consist of only
  50. *                    empty {}.
  51. *
  52. ******************************************************************************/
  53.  
  54. void setup_userfunc(int argc, char *argv[])
  55. {
  56. int i;
  57.  
  58.    argc--;
  59.  
  60.    fprintf(stdout, "Cmdline = < ");
  61.  
  62.    for( i = 0; i <= argc; i++)
  63.       fprintf(stdout, "%s ", argv[i]);
  64.  
  65.    fprintf(stdout, ">.\n");
  66.  
  67. }
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74. /******************************************************************************
  75. *
  76. * function_call() -  This function is called repeatedly by c-timer.exe during
  77. *                    the timing procedure. It should contain only a call to
  78. *                    the test function. Any additional code you need to execute
  79. *                    before calling your test function should be placed in
  80. *                    setup_userfunc() above.
  81. *
  82. *                    You must provide this function, although the test function
  83. *                    can be called whatever you like, as long as you prototype
  84. *                    it above.
  85. *
  86. ******************************************************************************/
  87.  
  88. void function_call(void)
  89. {
  90.  
  91.    userfunc(arg1, arg2, arg3);
  92.  
  93. }
  94.  
  95.  
  96.  
  97.  
  98.  
  99. /******************************************************************************
  100. *
  101. * This is where you place the test function, which can be called whatever
  102. * you like, as long as you make reference to it in function_call() above, and
  103. * prototype it above the call in function_call.
  104. *
  105. * Alternatively, you may place the test function in a separately compiled
  106. * module, as long as you prototype it above the call in function_call().
  107. *
  108. * This is a sample do-nothing function, provided as an example. If you compile
  109. * this as-is and link it with the approriate c-timer.obj module (c-timers.obj
  110. * for SMALL model, c-timerl.obj for LARGE model), the timed result should be
  111. * 0.001 ms/call 1000000 calls/sec.
  112. *
  113. ******************************************************************************/
  114.  
  115. void userfunc(unsigned int a, unsigned int b, unsigned int c)
  116. {
  117.    a++;
  118.    b++;
  119.    c++;
  120. }
  121.