source: ThirdParty/mpqc_open/src/lib/util/psi3/libpsio/done.cc

Candidate_v1.6.1
Last change on this file was 860145, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '0b990dfaa8c6007a996d030163a25f7f5fc8a7e7' as 'ThirdParty/mpqc_open'

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*!
2** \file done.cc
3** \ingroup (PSIO)
4*/
5
6#include <stdlib.h>
7#include <util/psi3/libpsio/psio.h>
8
9#ifdef PSIO_STATS
10#include <time.h>
11#endif
12
13namespace psi3 {
14namespace libpsio {
15
16/*!
17** \ingroup (PSIO)
18**
19** PSIO_DONE(): Frees global data used by the I/O routines.
20**
21** No arguments.
22*/
23
24int psio_done(void)
25{
26#ifdef PSIO_STATS
27 int i;
28 ULI total_read=0, total_write=0;
29 FILE *io_out;
30 time_t my_time;
31 my_time = time(NULL);
32 io_out = fopen("psio.dat", "a+");
33 fprintf(io_out, "\nLIBPSIO Read/Write Statistics\n\n");
34 fprintf(io_out, "Run at: %s\n", ctime(&my_time));
35 fprintf(io_out, "Unit Read(kB) Write(kB)\n");
36 fprintf(io_out, "-------------------------------\n");
37 for(i=0; i < PSIO_MAXUNIT; i++) {
38 total_read += psio_readlen[i];
39 total_write += psio_writlen[i];
40
41 if(psio_readlen[i] || psio_writlen[i])
42 fprintf(io_out, "%3d %10.1f %10.1f\n",i,
43 ((double) psio_readlen[i])/((double) 1024),
44 ((double) psio_writlen[i])/((double) 1024));
45 }
46 fprintf(io_out, "-------------------------------\n");
47 fprintf(io_out, "Total %10.1f %10.1f\n",
48 ((double) total_read)/((double) 1024),
49 ((double) total_write)/((double) 1024));
50 fclose(io_out);
51 free(psio_readlen);
52 free(psio_writlen);
53#endif
54
55 free(psio_unit);
56
57 _psi3_libpsio_state_ = 0;
58
59 return(0);
60}
61
62}
63}
Note: See TracBrowser for help on using the repository browser.