[Pw_forum] CPU Timing

Paul M. Grant w2agz at pacbell.net
Mon Apr 9 08:06:24 CEST 2007


To All (especially Paolo):

 

In February, Paolo sent me a "correction" to the standard distro of
espresso-3.2 for cputime, listed below.  I've now copied the new source of
cputime.c to 

/clib in my espresso directory.  I assume, of course, I have to re-"make,"
but do I have to re-"configure" as well?  Needless to say, I'm kind of
nervous about all this.

 

/*

  Copyright (C) 2002-2006 Quantum-Espresso group

  This file is distributed under the terms of the

  GNU General Public License. See the file `License'

  in the root directory of the present distribution,

  or http://www.gnu.org/copyleft/gpl.txt .

*/

 

#include <sys/time.h>

#include <sys/resource.h>

#include <unistd.h>

 

#include "c_defs.h"

 

double F77_FUNC(cclock,CCLOCK)()

 

/* Return the second elapsed since Epoch (00:00:00 UTC, January 1, 1970)

*/

 

{

 

    struct timeval tmp;

    double sec;

    gettimeofday( &tmp, (struct timezone *)0 );

    sec = tmp.tv_sec + ((double)tmp.tv_usec)/1000000.0;

    return sec;

 

}

 

double F77_FUNC(scnds,SCNDS) ( )

 

/* Return the cpu time associated to the current process

*/

 

{

        static struct rusage T;

 

        getrusage(RUSAGE_SELF, &T);

 

        return ((double)T.ru_utime.tv_sec +
((double)T.ru_utime.tv_usec)/1000000.0);

}

                                       

Paul M. Grant, PhD

Principal, W2AGZ Technologies

Visiting Scholar, Applied Physics, Stanford University

EPRI Science Fellow (Retired)

IBM Research Staff Member Emeritus

 <mailto:w2agz at pacbell.net> w2agz at pacbell.net

 <http://www.w2agz.com/> http://www.w2agz.com

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quantum-espresso.org/pipermail/users/attachments/20070408/140552d6/attachment.html>


More information about the users mailing list