1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/times.h>
#include <time.h>
#include "IO.hh"
#include "IEEEIO.hh"
#include "HDFIO.hh"
extern "C" {
void openf77_();
void writef77_(double *data);
void closef77_();
}
void main(){
double data[64*64*64];
int dims[3]={64,64,64};
int i,nds;
puts("--------------IEEE--------------");
for(i=0,nds=5;i<8;i++,nds+=5){
time_t stm,etm;
struct tms stms,etms;
time(&stm);
times(&stms);
IObase *file = new IEEEIO("speed.raw",IObase::Write);
fprintf(stderr,"Write %2u:",nds);
for(int n=0;n<nds;n++){
fprintf(stderr,"*");
file->write(IObase::Float64,3,dims,data);
}
delete file;
times(&etms);
time(&etm);
printf("\n\tRealtime=%d, UserTime=%d, SystemTime=%d, Combined=%u\n",
etm-stm,
etms.tms_utime-stms.tms_utime,
etms.tms_stime-stms.tms_stime,
etms.tms_utime-stms.tms_utime+etms.tms_stime-stms.tms_stime);
}
puts("--------------HDF---------------");
for(i=0,nds=5;i<8;i++,nds+=5){
time_t stm,etm;
struct tms stms,etms;
time(&stm);
times(&stms);
IObase *file = new HDFIO("speed.hdf",IObase::Write);
fprintf(stderr,"Write %2u:",nds);
for(int n=0;n<nds;n++){
fprintf(stderr,"*");
file->write(IObase::Float64,3,dims,data);
}
delete file;
times(&etms);
time(&etm);
printf("\n\tRealtime=%d, UserTime=%d, SystemTime=%d, Combined=%u\n",
etm-stm,
etms.tms_utime-stms.tms_utime,
etms.tms_stime-stms.tms_stime,
etms.tms_utime-stms.tms_utime+etms.tms_stime-stms.tms_stime);
}
puts("-------------F77 Unformatted---------------");
for(i=0,nds=5;i<8;i++,nds+=5){
time_t stm,etm;
struct tms stms,etms;
time(&stm);
times(&stms);
fprintf(stderr,"Write %2u:",nds);
openf77_();
// writef77_(dat,&nds);
for(int n=0;n<nds;n++){
fprintf(stderr,"*");
writef77_(data);
}
closef77_();
times(&etms);
time(&etm);
printf("\n\tRealtime=%d, UserTime=%d, SystemTime=%d, Combined=%u\n",
etm-stm,
etms.tms_utime-stms.tms_utime,
etms.tms_stime-stms.tms_stime,
etms.tms_utime-stms.tms_utime+etms.tms_stime-stms.tms_stime);
}
}
|