Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

dtime.c File Reference

#include "mrilib.h"
#include <unistd.h>

Go to the source code of this file.


Defines

#define FNAME   "Fred.Mertz"

Functions

int main (int argc, char *argv[])

Define Documentation

#define FNAME   "Fred.Mertz"
 

Definition at line 4 of file dtime.c.

Referenced by main(), and THD_freemegabytes().


Function Documentation

int main int    argc,
char *    argv[]
 

convert DTIStudio fiber format data to SUMA segment data

Definition at line 6 of file dtime.c.

References argc, COX_clock_time(), FNAME, malloc, and THD_is_file().

00007 {
00008    int nmeg , nrep , ii , jj ;
00009    char * bbb ;
00010    FILE * fp ;
00011 
00012    if( argc < 2 || strcmp(argv[1],"-help") == 0 ){
00013       printf("Usage: dtime meg rep\n"
00014              "Write 'meg' Mbytes of data to a file 'rep' times,\n"
00015              "and prints out the time that it takes.\n"
00016             ) ;
00017       exit(0) ;
00018    }
00019 
00020    nmeg = strtol( argv[1] , NULL , 10 ) * 1024 * 1024 ;
00021    nrep = strtol( argv[2] , NULL , 10 ) ;
00022 
00023    if( nmeg <= 0  || nrep <= 0 ){
00024       fprintf(stderr,"*** What are you, stupid?\n");
00025       exit(1);
00026    }
00027 
00028    if( THD_is_file(FNAME) ){
00029      fprintf(stderr,"Can't execute: temporary file %s exists!\n",FNAME) ;
00030      exit(1) ;
00031    }
00032 
00033    fp = fopen( FNAME , "wb" ) ;
00034 
00035    bbb = (char *) malloc( nmeg ) ;
00036    for( ii=0 ; ii < nmeg ; ii++ ) bbb[ii] = ii % 128 ;
00037 
00038    fprintf(stderr,"=== Initialization complete\n") ;
00039 
00040    (void) COX_clock_time() ;
00041 
00042    for( jj=0 ; jj < nrep ; jj++ ){
00043       fwrite( bbb , 1 , nmeg , fp ) ; fflush(fp) ; fsync(fileno(fp)) ; sync() ;
00044       fprintf(stderr,"#%03d: clock=%g\n", jj+1 , COX_clock_time() ) ;
00045    }
00046 
00047    fprintf(stderr,"=== %g Mbytes/second average\n",
00048            nmeg*nrep/(1024.*1024.*COX_clock_time()) ) ;
00049 
00050    fclose(fp) ; remove(FNAME) ; exit(0) ;
00051 }
 

Powered by Plone

This site conforms to the following standards: