Annotation of parser3/src/types/pa_vstatus.C, revision 1.1

1.1     ! paf         1: /** @file
        !             2:        Parser: @b status class impl.
        !             3: 
        !             4:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
        !             5:        Author: Alexander Petrosyan <paf@design.ru> (http://paf.design.ru)
        !             6: 
        !             7:        $Id: pa_vstatus.h,v 1.4 2001/11/08 11:04:13 paf Exp $
        !             8: */
        !             9: 
        !            10: #include "pa_vstatus.h"
        !            11: #include "pa_cache_managers.h"
        !            12: 
        !            13: Value *VStatus::get_element(const String& aname) {
        !            14:        // getstatus
        !            15:        if(Cache_manager *manager=static_cast<Cache_manager *>(cache_managers->get(aname)))
        !            16:                return &manager->get_status(pool(), &aname);
        !            17: 
        !            18: #ifdef HAVE_GETRUSAGE
        !            19:        // rusage
        !            20:        if(aname=="rusage") {
        !            21:                VHash& rusage=*new(pool) VHash(pool);
        !            22:            struct rusage u;
        !            23:            if(int error=getrusage(RUSAGE_SELF,&u))
        !            24:                        throw Exception(0, 0,
        !            25:                                &aname,
        !            26:                                "getrusage failed (%d)", error);
        !            27: 
        !            28:                Hash& hash=rusage.hash(aname);
        !            29:                hash.put(*new(pool) String(pool, "utime"), new(pool) VDouble(pool, 
        !            30:                        u.ru_utime.tv_sec+u.ru_utime.tv_usec/10000));
        !            31:                hash.put(*new(pool) String(pool, "stime"), new(pool) VDouble(pool, 
        !            32:                        u.ru_stime.tv_sec+u.ru_stime.tv_usec/10000));
        !            33:                hash.put(*new(pool) String(pool, "maxrss"), new(pool) VDouble(pool, u.ru_maxrss));
        !            34:                hash.put(*new(pool) String(pool, "ixrss"), new(pool) VDouble(pool, u.ru_ixrss));
        !            35:                hash.put(*new(pool) String(pool, "idrss"), new(pool) VDouble(pool, u.ru_idrss));
        !            36:                hash.put(*new(pool) String(pool, "isrss"), new(pool) VDouble(pool, u.ru_isrss));
        !            37: 
        !            38:                return &rusage;
        !            39:        }
        !            40: 
        !            41: #endif
        !            42: 
        !            43:        return 0;
        !            44: }

E-mail: