~ubuntu-branches/ubuntu/karmic/psicode/karmic

« back to all changes in this revision

Viewing changes to src/bin/detci/time.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2009-02-23 00:12:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090223001202-rutldoy3dimfpesc
Tags: 3.4.0-1
* New upstream release.

[ Michael Banck ]
* debian/patches/01_DESTDIR.dpatch: Refreshed.
* debian/patches/02_FHS.dpatch: Removed, applied upstream.
* debian/patches/03_debian_docdir: Likewise.
* debian/patches/04_man.dpatch: Likewise.
* debian/patches/06_466828_fix_gcc_43_ftbfs.dpatch: Likewise.
* debian/patches/07_464867_move_executables: Fixed and refreshed.
* debian/patches/00list: Adjusted.
* debian/control: Improved description.
* debian/patches-held: Removed.
* debian/rules (install/psi3): Do not ship the ruby bindings for now.

[ Daniel Leidert ]
* debian/rules: Fix txtdir via DEB_MAKE_INSTALL_TARGET.
* debian/patches/01_DESTDIR.dpatch: Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*! \file
 
2
    \ingroup DETCI
 
3
    \brief DETCI-specific timing routines
 
4
*/
 
5
 
 
6
#include <unistd.h>
 
7
#include <sys/time.h>
 
8
#include <cstdlib>
 
9
#include <cstdio>
 
10
#include "structs.h"
 
11
#define EXTERN
 
12
#include "globals.h"
 
13
 
 
14
namespace psi { namespace detci {
 
15
 
 
16
double
 
17
wall_time_new(void)
 
18
{
 
19
  struct timeval tod;
 
20
  gettimeofday(&tod,0);
 
21
  return (double) (tod.tv_sec + 0.000001 * tod.tv_usec);
 
22
}
 
23
 
 
24
void 
 
25
init_time_new(struct detci_timings time)
 
26
{
 
27
 time.s1_total_time = time.s1_before_time = time.s1_after_time = 0.0;
 
28
 time.s2_total_time = time.s2_before_time = time.s2_after_time = 0.0;
 
29
 time.s3_total_time = time.s3_before_time = time.s3_after_time = 0.0;
 
30
 time.write_total_time = time.write_after_time = time.write_before_time = 0.0;
 
31
 time.read_total_time = time.read_after_time = time.read_before_time = 0.0;
 
32
 time.Hd_total_time = time.Hd_before_time = time.Hd_after_time = 0.0;
 
33
 time.total_before_time = time.total_after_time = 0.0;
 
34
}
 
35
 
 
36
void
 
37
print_time_new(struct detci_timings time)
 
38
{
 
39
  fprintf(outfile,"\n");
 
40
  fprintf(outfile,"        Total Time (s)     %%Time            %%Relative\n");
 
41
  fprintf(outfile," -----------------------------------------------------\n");
 
42
  fprintf(outfile," Read      %lf\n", time.read_total_time);
 
43
  fprintf(outfile," Write     %lf\n", time.write_total_time);
 
44
  fprintf(outfile," Sigma1    %lf\n", time.s1_total_time);
 
45
  fprintf(outfile," Sigma2    %lf\n", time.s2_total_time);
 
46
  fprintf(outfile," Sigma3    %lf\n", time.s3_total_time);
 
47
  fprintf(outfile," S1 Thread %lf\n", time.s1_mt_total_time);
 
48
  fprintf(outfile," S2 Thread %lf\n", time.s2_mt_total_time);
 
49
  fprintf(outfile," S3 Thread %lf\n", time.s3_mt_total_time);
 
50
  fprintf(outfile,"\n");
 
51
}
 
52
 
 
53
}} // namespace psi::detci
 
54