source: git/Singular/mpsr_Timer.cc @ 6ce030f

jengelh-datetimespielwiese
Last change on this file since 6ce030f was 6ce030f, checked in by Oleksandr Motsak <motsak@…>, 11 years ago
removal of the $Id$ svn tag from everywhere NOTE: the git SHA1 may be used instead (only on special places) NOTE: the libraries Singular/LIB/*.lib still contain the marker due to our current use of svn
  • Property mode set to 100644
File size: 1.1 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4
5
6/***************************************************************
7 *
8 * File:       mpsr_Timer.cc
9 * Purpose:    definitions for a simple timer
10 * Author:     Olaf Bachmann (10/95)
11 *
12 * Change History (most recent first):
13 *
14 ***************************************************************/
15
16#include"mpsr_Timer.h"
17#include<stdio.h>
18
19void mpsr_StartTimer(mpsr_Timer_pt t_mpsr)
20{
21  tms t_tms;
22
23  t_mpsr->t_time = times(&t_tms);
24  t_mpsr->s_time = t_tms.tms_stime;
25  t_mpsr->u_time = t_tms.tms_utime;
26}
27
28void mpsr_StopTimer(mpsr_Timer_pt t_mpsr)
29{
30  tms t_tms;
31
32  t_mpsr->t_time = times(&t_tms) - t_mpsr->t_time;
33  t_mpsr->s_time = t_tms.tms_stime - t_mpsr->s_time;
34  t_mpsr->u_time = t_tms.tms_utime - t_mpsr->u_time;
35}
36
37void mpsr_PrintTimer(mpsr_Timer_pt t_mpsr, char *str)
38{
39  printf("%s", str);
40  printf("User   time: %.2f \n", (float) t_mpsr->u_time / (float) HZ);
41  printf("System time: %.2f \n", (float) t_mpsr->u_time / (float) HZ);
42  printf("Real   time: %.2f \n", (float) t_mpsr->u_time / (float) HZ);
43}
Note: See TracBrowser for help on using the repository browser.