timerhep.c

Go to the documentation of this file.
00001 /*                      T I M E R H E P . C
00002  * BRL-CAD
00003  *
00004  * Copyright (c) 2004-2006 United States Government as represented by
00005  * the U.S. Army Research Laboratory.
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License
00009  * as published by the Free Software Foundation; either version 2 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this file; see the file named COPYING for more
00019  * information.
00020  */
00021 
00022 /** @addtogroup timer */
00023 
00024 /*@{*/
00025 
00026 /** @file timerhep.c
00027  * To provide timing information for RT.
00028  *      THIS VERSION FOR Denelcor HEP/UPX (System III-like)
00029  */
00030 
00031 #ifndef lint
00032 static const char RCShep[] = "@(#)$Header: /cvsroot/brlcad/brlcad/src/librt/timerhep.c,v 14.9 2006/09/16 02:04:26 lbutler Exp $ (BRL)";
00033 #endif
00034 
00035 #include <stdio.h>
00036 
00037 /* Standard System V stuff */
00038 extern long time(time_t *);
00039 static long time0;
00040 
00041 
00042 /*
00043  *                      P R E P _ T I M E R
00044  */
00045 void
00046 rt_prep_timer(void)
00047 {
00048         (void)time(&time0);
00049         (void)intime_();
00050 }
00051 
00052 
00053 /*
00054  *                      R E A D _ T I M E R
00055  *
00056  */
00057 double
00058 rt_read_timer(char *str, int len)
00059 {
00060         long now;
00061         double usert;
00062         long htime[6];
00063         char line[132];
00064 
00065         (void)stats_(htime);
00066         (void)time(&now);
00067         usert = ((double)htime[0]) / 10000000.0;
00068         if( usert < 0.00001 )  usert = 0.00001;
00069         sprintf(line,"%f secs: %ld wave, %ld fp, %ld dmem, %ld other",
00070                 usert,
00071                 htime[0], htime[1], htime[2], htime[3], htime[4] );
00072         (void)strncpy( str, line, len );
00073         return( usert );
00074 }
00075 
00076 /*@}*/
00077 /*
00078  * Local Variables:
00079  * mode: C
00080  * tab-width: 8
00081  * c-basic-offset: 4
00082  * indent-tabs-mode: t
00083  * End:
00084  * ex: shiftwidth=4 tabstop=8
00085  */

Generated on Mon Sep 18 01:24:57 2006 for BRL-CAD by  doxygen 1.4.6