IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5083


Ignore:
Timestamp:
Sep 20, 2005, 4:11:16 PM (21 years ago)
Author:
drobbin
Message:

Implemented prototype and new code for psTimer fxns, tested, and debugged

Location:
trunk/psLib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/pslib.kdevelop

    r4887 r5083  
    1 <?xml version = '1.0'?>
    2 <kdevelop>
    3   <general>
    4     <author>Robert Daniel DeSonia</author>
    5     <email>robert.desonia@mhpcc.hpc.mil</email>
    6     <version>1.6</version>
    7     <projectmanagement>KDevAutoProject</projectmanagement>
    8     <primarylanguage>C</primarylanguage>
    9     <keywords>
    10       <keyword>C</keyword>
    11       <keyword>Code</keyword>
    12     </keywords>
    13     <ignoreparts/>
    14     <projectdirectory>.</projectdirectory>
    15     <absoluteprojectpath>false</absoluteprojectpath>
    16     <description/>
    17     <secondaryLanguages/>
    18   </general>
    19   <kdevautoproject>
    20     <general>
    21       <activetarget>src/pslib</activetarget>
    22       <useconfiguration>default</useconfiguration>
    23     </general>
    24     <run>
    25       <mainprogram>src/pslib</mainprogram>
    26       <terminal>true</terminal>
    27       <directoryradio>executable</directoryradio>
    28     </run>
    29     <configurations>
    30       <optimized>
    31         <builddir>optimized</builddir>
    32         <ccompiler>kdevgccoptions</ccompiler>
    33         <cxxcompiler>kdevgppoptions</cxxcompiler>
    34         <f77compiler>kdevg77options</f77compiler>
    35         <cflags>-O2 -g0 </cflags>
    36       </optimized>
    37       <debug>
    38         <configargs>--enable-debug=full</configargs>
    39         <builddir>debug</builddir>
    40         <ccompiler>kdevgccoptions</ccompiler>
    41         <cxxcompiler>kdevgppoptions</cxxcompiler>
    42         <f77compiler>kdevg77options</f77compiler>
    43         <cflags>-O0 -g3 </cflags>
    44       </debug>
    45     </configurations>
    46     <make>
    47       <envvars>
    48         <envvar value="1" name="WANT_AUTOCONF_2_5" />
    49         <envvar value="1" name="WANT_AUTOMAKE_1_6" />
    50       </envvars>
    51     </make>
    52   </kdevautoproject>
    53   <kdevdoctreeview>
    54     <ignoretocs>
    55       <toc>ada</toc>
    56       <toc>ada_bugs_gcc</toc>
    57       <toc>bash</toc>
    58       <toc>bash_bugs</toc>
    59       <toc>clanlib</toc>
    60       <toc>w3c-dom-level2-html</toc>
    61       <toc>fortran_bugs_gcc</toc>
    62       <toc>gnome1</toc>
    63       <toc>gnustep</toc>
    64       <toc>gtk</toc>
    65       <toc>gtk_bugs</toc>
    66       <toc>haskell</toc>
    67       <toc>haskell_bugs_ghc</toc>
    68       <toc>java_bugs_gcc</toc>
    69       <toc>java_bugs_sun</toc>
    70       <toc>kde2book</toc>
    71       <toc>libstdc++</toc>
    72       <toc>opengl</toc>
    73       <toc>pascal_bugs_fp</toc>
    74       <toc>php</toc>
    75       <toc>php_bugs</toc>
    76       <toc>perl</toc>
    77       <toc>perl_bugs</toc>
    78       <toc>python</toc>
    79       <toc>python_bugs</toc>
    80       <toc>qt-kdev3</toc>
    81       <toc>ruby</toc>
    82       <toc>ruby_bugs</toc>
    83       <toc>sdl</toc>
    84       <toc>stl</toc>
    85       <toc>w3c-svg</toc>
    86       <toc>sw</toc>
    87       <toc>w3c-uaag10</toc>
    88       <toc>wxwidgets_bugs</toc>
    89     </ignoretocs>
    90     <ignoreqt_xml>
    91       <toc>Guide to the Qt Translation Tools</toc>
    92       <toc>Qt Assistant Manual</toc>
    93       <toc>Qt Designer Manual</toc>
    94       <toc>Qt Reference Documentation</toc>
    95       <toc>qmake User Guide</toc>
    96     </ignoreqt_xml>
    97     <ignoredoxygen>
    98       <toc>KDE Libraries (Doxygen)</toc>
    99     </ignoredoxygen>
    100   </kdevdoctreeview>
    101   <kdevfilecreate>
    102     <useglobaltypes>
    103       <type ext="c" />
    104       <type ext="h" />
    105     </useglobaltypes>
    106   </kdevfilecreate>
    107   <kdevfileview>
    108     <groups>
    109       <group pattern="*.h" name="Header files" />
    110       <group pattern="*.c" name="Source files" />
    111       <hidenonprojectfiles>false</hidenonprojectfiles>
    112       <hidenonlocation>false</hidenonlocation>
    113     </groups>
    114     <tree>
    115       <hidepatterns>*.o,*.lo,CVS</hidepatterns>
    116       <hidenonprojectfiles>false</hidenonprojectfiles>
    117       <showvcsfields>false</showvcsfields>
    118     </tree>
    119   </kdevfileview>
    120   <kdevdocumentation>
    121     <projectdoc>
    122       <docsystem>Doxygen Documentation Collection</docsystem>
    123       <docurl>${APPNAMELC}.tag</docurl>
    124     </projectdoc>
    125   </kdevdocumentation>
    126   <substmap>
    127     <APPNAME>psLib</APPNAME>
    128     <APPNAMELC>pslib</APPNAMELC>
    129     <APPNAMEUC>PSLIB</APPNAMEUC>
    130     <AUTHOR>Robert Daniel DeSonia</AUTHOR>
    131     <CFLAGS/>
    132     <EMAIL>robert.desonia@mhpcc.hpc.mil</EMAIL>
    133     <LICENSE>GPL</LICENSE>
    134     <LICENSEFILE>COPYING</LICENSEFILE>
    135     <OPT_INCS>-I/usr/include</OPT_INCS>
    136     <OPT_LIBS>-lm</OPT_LIBS>
    137     <VERSION>1.5</VERSION>
    138     <dest>/home/desonia/pslib</dest>
    139   </substmap>
    140   <kdevcppsupport>
    141     <references/>
    142     <codecompletion>
    143       <includeGlobalFunctions>true</includeGlobalFunctions>
    144       <includeTypes>true</includeTypes>
    145       <includeEnums>true</includeEnums>
    146       <includeTypedefs>false</includeTypedefs>
    147       <automaticCodeCompletion>true</automaticCodeCompletion>
    148       <automaticArgumentsHint>true</automaticArgumentsHint>
    149       <automaticHeaderCompletion>true</automaticHeaderCompletion>
    150       <codeCompletionDelay>250</codeCompletionDelay>
    151       <argumentsHintDelay>400</argumentsHintDelay>
    152       <headerCompletionDelay>250</headerCompletionDelay>
    153     </codecompletion>
    154     <creategettersetter>
    155       <prefixGet/>
    156       <prefixSet>set</prefixSet>
    157       <prefixVariable>m_,_</prefixVariable>
    158       <parameterName>theValue</parameterName>
    159       <inlineGet>true</inlineGet>
    160       <inlineSet>true</inlineSet>
    161     </creategettersetter>
    162   </kdevcppsupport>
    163   <cppsupportpart>
    164     <filetemplates>
    165       <interfacesuffix>.h</interfacesuffix>
    166       <implementationsuffix>.cpp</implementationsuffix>
    167     </filetemplates>
    168   </cppsupportpart>
    169   <kdevdebugger>
    170     <general>
    171       <programargs/>
    172       <gdbpath/>
    173       <dbgshell>libtool</dbgshell>
    174       <configGdbScript/>
    175       <runShellScript/>
    176       <runGdbScript/>
    177       <breakonloadinglibs>true</breakonloadinglibs>
    178       <separatetty>false</separatetty>
    179       <floatingtoolbar>false</floatingtoolbar>
    180     </general>
    181     <display>
    182       <staticmembers>false</staticmembers>
    183       <demanglenames>true</demanglenames>
    184       <outputradix>10</outputradix>
    185     </display>
    186   </kdevdebugger>
    187   <kdevcvsservice>
    188     <recursivewhenupdate>true</recursivewhenupdate>
    189     <prunedirswhenupdate>true</prunedirswhenupdate>
    190     <createdirswhenupdate>true</createdirswhenupdate>
    191     <recursivewhencommitremove>true</recursivewhencommitremove>
    192     <revertoptions>-C</revertoptions>
    193   </kdevcvsservice>
    194 </kdevelop>
  • trunk/psLib/src/astro/psTime.c

    r5015 r5083  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.70 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-09-13 01:09:58 $
     12 *  @version $Revision: 1.71 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-09-21 02:11:16 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    16111611}
    16121612
     1613static psHash *timers = NULL;
     1614static char timerName[256] = "\0";
     1615
     1616static void psTimerFree ()
     1617{
     1618
     1619    psFree (timers);
     1620    p_psTimeFinalize();
     1621    return;
     1622}
     1623
     1624// start/restart a named timer
     1625bool psTimerStart (char *name)
     1626{
     1627
     1628    psTime *start;
     1629
     1630    if (timers == NULL) {
     1631        timers = psHashAlloc (16);
     1632        //        psMemSetDeallocator(timers, (psFreeFunc)psTimerFree);
     1633    }
     1634    strncpy(timerName, name, 256);
     1635    start = psTimeGetNow (PS_TIME_UTC);
     1636    psHashAdd (timers, name, start);
     1637    psFree (start);
     1638    return (true);
     1639}
     1640
     1641psF64 psTimerClear (char *name)
     1642{
     1643    psF64 timerTime = 0.0;
     1644    bool status;
     1645
     1646    if (name == NULL)
     1647        return false;
     1648    timerTime = psTimerMark(name);
     1649    status = psHashRemove (timers, name);
     1650    strncpy(timerName, "\0", 256);
     1651    if ( !status )
     1652        return 0.0;
     1653    else
     1654        return timerTime;
     1655}
     1656
     1657// get current elapsed time on named timer
     1658psF64 psTimerMark (char *name)
     1659{
     1660
     1661    psTime *start;
     1662    psTime *mark;
     1663    psF64   delta;
     1664
     1665    if (timers == NULL)
     1666        return (0);
     1667    start = (psTime*)psHashLookup (timers, name);
     1668    if (start == NULL)
     1669        return (0);
     1670    mark = psTimeGetNow (PS_TIME_UTC);
     1671    delta = psTimeDelta (mark, start);
     1672    psFree (mark);
     1673    // psFree (start); -- XXX is psHashLookup not psMemCopying?
     1674
     1675    return (delta);
     1676}
     1677
     1678psF64 psTimerStop(void)
     1679{
     1680    psF64 timerTime = 0.0;
     1681
     1682    if ( strncmp(timerName, "\0", 256) )
     1683        timerTime = psTimerMark(timerName);
     1684    strncpy(timerName, "\0", 2);
     1685    psTimerFree();
     1686    return timerTime;
     1687}
     1688
     1689void psTimeInitialize(const char *timeConfig)
     1690{
     1691    p_psTimeInit(timeConfig);
     1692}
     1693
     1694void psTimeFinalize(void)
     1695{
     1696    p_psTimeFinalize();
     1697}
     1698
  • trunk/psLib/src/astro/psTime.h

    r5015 r5083  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-09-13 01:09:58 $
     13 *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-09-21 02:11:16 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8282);
    8383
     84/** Initialize time data.
     85 *
     86 *  Reads the configuration file and sets up the appropriate psTimeTables and predictions.
     87 */
     88void psTimeInitialize(
     89    const char *timeConfig             ///< psTime configuration file
     90);
     91
    8492/** Free memory persistant time data.
    8593 *
     
    8997 */
    9098psBool p_psTimeFinalize(void);
     99
     100/** Frees memory that was allocated by psTime functions.
     101 *
     102 *  Allows a subsequent search for leaked memory.
     103 */
     104void psTimeFinalize(void);
    91105
    92106/** Allocate time struct.
     
    369383);
    370384
     385bool psTimerStart(
     386    char *name
     387);
     388
     389psF64 psTimerClear(
     390    char *name
     391);
     392
     393psF64 psTimerMark(
     394    char *name
     395);
     396
     397psF64 psTimerStop(void);
     398
    371399/// @}
    372400
  • trunk/psLib/test/astro/tst_psTime_04.c

    r5018 r5083  
    1515 *  @author  Eric Van Alst, MHPCC
    1616 *
    17  *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
    18  *  @date  $Date: 2005-09-13 01:39:13 $
     17 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
     18 *  @date  $Date: 2005-09-21 02:11:16 $
    1919 *
    2020 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3232static psS32 testTimeInit5(void);
    3333static psS32 testTimeInit6(void);
     34static psS32 testTimer1(void);
    3435
    3536testDescription tests[] = {
     
    4041                              {testTimeInit5,000,"p_psTimeInit",0,false},
    4142                              {testTimeInit6,000,"p_psTimeInit",0,false},
     43                              {testTimer1,000,"psTimer",0,false},
    4244                              {NULL}
    4345                          };
     
    105107}
    106108
     109psS32 testTimer1(void)
     110{
     111    psF64 testTime = 0.0;
     112    psF64 testTime2 = 0.0;
     113    psF64 testTime3 = 0.0;
     114
     115    if ( !psTimerStart("newTime") ) {
     116        printf("TimerStart Failed\n");
     117        return 1;
     118    }
     119    testTime = psTimerMark("newTime");
     120    if (testTime == 0.0) {
     121        printf("TimerMark Failed\n");
     122        return 2;
     123    }
     124    testTime2 = psTimerClear("newTime");
     125    if (testTime2 == 0.0) {
     126        printf("TimerClear Failed\n");
     127        return 3;
     128    }
     129    psTimerStart("newTime");
     130    testTime3 = psTimerStop();
     131    if (testTime3 == 0.0) {
     132        printf("TimerStop Failed\n");
     133        return 4;
     134    }
     135    return 0;
     136}
     137
  • trunk/psLib/test/astro/verified/tst_psTime_04.stderr

    r4547 r5083  
    7373---> TESTPOINT PASSED (psTime{p_psTimeInit} | tst_psTime_04.c)
    7474
     75/***************************** TESTPOINT ******************************************\
     76*             TestFile: tst_psTime_04.c                                            *
     77*            TestPoint: psTime{psTimer}                                            *
     78*             TestType: Positive                                                   *
     79\**********************************************************************************/
     80
     81
     82---> TESTPOINT PASSED (psTime{psTimer} | tst_psTime_04.c)
     83
Note: See TracChangeset for help on using the changeset viewer.