* g77 questions @ 2001-10-28 10:52 Che-ming Yang 2001-10-28 13:02 ` Toon Moene 0 siblings, 1 reply; 3+ messages in thread From: Che-ming Yang @ 2001-10-28 10:52 UTC (permalink / raw) To: gcc-help Hello: I just start to use g77 compiler. I have a huge program which I have been successfully converting to the g77 supported options except the following. I consult the document first without much success. I would be very much appreciated if you can give me at least some hint. (1) The $ sign I used in the IO format only works for WRITE but not for READ. Is there a equivalent option that I can use to stop reading or writing in the same line and be able to continue reading or writing later at the same location rather than the new line? (2) Is PAUSE supported by g77? What is the correct syntax? (3) Can I get the system time down to 1/100 of a second? (4) Can you suggest some helpful document or book that I can use for questions of the above kind? Thank you in advance for your help? Che-ming ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: g77 questions 2001-10-28 10:52 g77 questions Che-ming Yang @ 2001-10-28 13:02 ` Toon Moene 2001-10-29 0:14 ` Der Herr Hofrat 0 siblings, 1 reply; 3+ messages in thread From: Toon Moene @ 2001-10-28 13:02 UTC (permalink / raw) To: Che-ming Yang; +Cc: gcc-help Che-ming Yang wrote: > I just start to use g77 compiler. I have a huge program which I have > been successfully converting to the g77 supported options except the > following. I consult the document first without much success. I would > be very much appreciated if you can give me at least some hint. > (1) The $ sign I used in the IO format only works for WRITE but not > for READ. Is there a equivalent option that I can use to stop reading > or writing in the same line and be able to continue reading or > writing later at the same location rather than the new line? No. I'm a bit surprised that you need that - in the 6 years that g77 exists now, nobody ever has asked for that feature ... > (2) Is PAUSE supported by g77? What is the correct syntax? Just: PAUSE. It will print a string and continue if you type 'go'. > (3) Can I get the system time down to 1/100 of a second? That depends on resolution of the gettimeofday system call on your OS. Consult the man page of gettimeofday to get the answer to this question. > (4) Can you suggest some helpful document or book that I can use for > questions of the above kind? Well, as far as g77 is concerned, the only thing we have is the documentation (texinfo files) that accompanies the compiler. > Thank you in advance for your help? Hope this helps, -- Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290 Saturnushof 14, 3738 XG Maartensdijk, The Netherlands Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction) ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: g77 questions 2001-10-28 13:02 ` Toon Moene @ 2001-10-29 0:14 ` Der Herr Hofrat 0 siblings, 0 replies; 3+ messages in thread From: Der Herr Hofrat @ 2001-10-29 0:14 UTC (permalink / raw) To: Toon Moene; +Cc: Che-ming Yang, gcc-help > > > (3) Can I get the system time down to 1/100 of a second? > > That depends on resolution of the gettimeofday system call on your OS. > Consult the man page of gettimeofday to get the answer to this question. > atleast on Linux gettimeofday could do it - but even on an idle system two consecutive calls to gettimeofday can exhibit jitter of up to 1s (for instance when reiserfs is balancing its trees or if external interrupts hit between the getttimeofday calls). here is a littl program (should work on other platforms as long as you don't use the x86 specific TSC reads). jitt.c executes in scheduling policy SCHED_FIFO, so unless you have that posibility you should run it with policy set to SCHED_OTHER. if you let it run long enough I guess all systems will show jitter far above 1/100 of a second - so don't try to rely on a timestamp obtained by gettimeofday. If you realy need it you need an RTOS. hofrat ----jitt.c mesur user-space jitter--- #include <sched.h> #include <stdio.h> #include <sys/time.h> #include <unistd.h> #include <stdlib.h> #include <math.h> __inline__ unsigned long long int hwtime_in_us( void ) { unsigned long long int x; __asm__("rdtsc\n\t" "mov %%edx, %%ecx\n\t" :"=A" (x)); return (x/1000); } inline unsigned long long int timeofday_in_us( void ) { struct timeval tv; struct timezone tz; unsigned long long int min = 0, sec = 0, usec = 0; if ( gettimeofday( &tv, &tz ) != -1 ) { min = tz.tz_minuteswest; sec = tv.tv_sec; usec = tv.tv_usec; } return (unsigned long long int)( ( ((min)*60) + (sec) )*1000000 + (usec) ); } // on x86 you can use the TSC on otheres use timeofday - hofrat //unsigned long long int (*time_in_us)(void) = hwtime_in_us; unsigned long long int (*time_in_us)(void) = timeofday_in_us; #define C 1000 /* count of loops */ #define b 2 /* base for logarithmic jitter */ #define N 1024 /* number of points in distribution */ #define S 1 /* sleep time in usecs */ int main(void) { float a; unsigned int i; unsigned long long int count=0; unsigned long long int time1, time2; unsigned int jitter=0, jitter_max=0, jitter_min=10000; unsigned int distribution[N]; struct sched_param p; int error; /* error = sched_getparam( 0, &p ); if ( error < 0 ) { printf("count not get sched_param\n"); exit(1); } p.sched_priority = sched_get_priority_max( SCHED_FIFO ); error = sched_setscheduler( 0, SCHED_FIFO, &p ); if ( error < 0 ) { printf("count not set priority SCHED_FIFO\n"); exit(1); } */ for ( i=0; i<N; i++ ) distribution[i] = 0; time1 = time_in_us(); while(count<C) { time1 = time_in_us(); time2 = time_in_us(); jitter = (unsigned int)( time2 - time1 ); if ( jitter > 0 ) i = (int)(log((float)(jitter))/log((float)(b)))+1; else i = 0; if (i>=N) i = N-1; distribution[i]++; if ( jitter > jitter_max ) jitter_max = jitter; if ( jitter < jitter_min ) jitter_min = jitter; printf( "jitter = %d\n", jitter); for ( i=0;i<100;i++ ) a = sqrt(4.0); count++; usleep(S); } for ( i=0; i<N; i++ ) { if ( distribution[i] > 0 ) printf( "jitter less than %8.0f us = %d\n", pow((float)(b),(float)(i)), distribution[i] ); } printf( "jitter worst case = %8u us\n", jitter_max ); return 0; } ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-10-29 0:14 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2001-10-28 10:52 g77 questions Che-ming Yang 2001-10-28 13:02 ` Toon Moene 2001-10-29 0:14 ` Der Herr Hofrat
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).