PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/NBIS/commonnbis/src/lib/util/ticks.c

https://gitlab.com/d.esterman/ba-phmf
C | 93 lines | 21 code | 7 blank | 65 comment | 0 complexity | 2f30c579471bc729e5facfb16f37f297 MD5 | raw file
  1. /*******************************************************************************
  2. License:
  3. This software and/or related materials was developed at the National Institute
  4. of Standards and Technology (NIST) by employees of the Federal Government
  5. in the course of their official duties. Pursuant to title 17 Section 105
  6. of the United States Code, this software is not subject to copyright
  7. protection and is in the public domain.
  8. This software and/or related materials have been determined to be not subject
  9. to the EAR (see Part 734.3 of the EAR for exact details) because it is
  10. a publicly available technology and software, and is freely distributed
  11. to any interested party with no licensing requirements. Therefore, it is
  12. permissible to distribute this software as a free download from the internet.
  13. Disclaimer:
  14. This software and/or related materials was developed to promote biometric
  15. standards and biometric technology testing for the Federal Government
  16. in accordance with the USA PATRIOT Act and the Enhanced Border Security
  17. and Visa Entry Reform Act. Specific hardware and software products identified
  18. in this software were used in order to perform the software development.
  19. In no case does such identification imply recommendation or endorsement
  20. by the National Institute of Standards and Technology, nor does it imply that
  21. the products and equipment identified are necessarily the best available
  22. for the purpose.
  23. This software and/or related materials are provided "AS-IS" without warranty
  24. of any kind including NO WARRANTY OF PERFORMANCE, MERCHANTABILITY,
  25. NO WARRANTY OF NON-INFRINGEMENT OF ANY 3RD PARTY INTELLECTUAL PROPERTY
  26. or FITNESS FOR A PARTICULAR PURPOSE or for any purpose whatsoever, for the
  27. licensed product, however used. In no event shall NIST be liable for any
  28. damages and/or costs, including but not limited to incidental or consequential
  29. damages of any kind, including economic damage or injury to property and lost
  30. profits, regardless of whether NIST shall be advised, have reason to know,
  31. or in fact shall know of the possibility.
  32. By using this software, you agree to bear all risk relating to quality,
  33. use and performance of the software and/or related materials. You agree
  34. to hold the Government harmless from any claim arising from your use
  35. of the software.
  36. *******************************************************************************/
  37. /***********************************************************************
  38. LIBRARY: UTIL - General Purpose Utility Routines
  39. FILE: TICKS.C
  40. AUTHOR: JAMES BLUE
  41. DATE: 11/13/1990
  42. Contains routines responsible for accumulating the number of clock
  43. cycles (ticks) used by a process.
  44. ROUTINES:
  45. #cat: ticks - returns the number of clock cycles (ticks) used by a process.
  46. #cat:
  47. #cat: ticksPerSec - returns the system definition for HZ, where 1/HZ seconds
  48. #cat: is a tick (HZ = 60).
  49. ***********************************************************************/
  50. #include <sys/types.h>
  51. #ifndef __MSYS__
  52. #include <sys/times.h>
  53. #endif
  54. #include <sys/param.h>
  55. #include <time.h>
  56. #include <unistd.h>
  57. /* ticks 13-Nov-90 15:41
  58. * Get number of ticks used by process.
  59. */
  60. clock_t
  61. ticks(void)
  62. {
  63. struct tms buff;
  64. #ifndef __MSYS__
  65. times(&buff);
  66. #endif
  67. return buff.tms_utime;
  68. }
  69. /* ticksPerSec 13-Nov-90 15:41
  70. * Get number of ticks per second reported by times().
  71. */
  72. int
  73. ticksPerSec(void)
  74. {
  75. return (int)sysconf(_SC_CLK_TCK);
  76. }