Savarese Software Research Corporation
memusage.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2009 Savarese Software Research Corporation
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     https://www.savarese.com/software/ApacheLicense-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00023 #ifndef __SSRC_WSPR_UTILITY_MEMUSAGE_H
00024 #define __SSRC_WSPR_UTILITY_MEMUSAGE_H
00025 
00026 #include <ssrc/wispers-packages.h>
00027 #include <ssrc/wisp/utility/wisp_struct.h>
00028 
00029 __BEGIN_NS_SSRC_WSPR_UTILITY
00030 
00031 // TODO: Implement for FreeBSD.
00032 #if defined(linux) || defined(__linux) || defined(__linux__)
00033 
00034 #define WISPERS_HAVE_GET_MEMUSAGE 1
00035 
00036 WISP_STRUCT(memusage,
00037             ((unsigned int, size))      // total program size
00038             ((unsigned int, resident))  // resident set size
00039             ((unsigned int, share))     // shared pages
00040             ((unsigned int, text))      // text (code)
00041             ((unsigned int, lib))       // library
00042             ((unsigned int, data))      // data/stack
00043             ((unsigned int, dt))        // dirty pages (unused in Linux 2.6)
00044             ((unsigned int, page_size)));
00045 
00046 #elif defined(sun) || defined(__sun) || defined(__sun__)
00047 
00048 #define WISPERS_HAVE_GET_MEMUSAGE 1
00049 
00050 WISP_STRUCT(memusage,
00051             ((unsigned int, size))
00052             ((unsigned int, resident))
00053             ((unsigned int, heap))
00054             ((unsigned int, stack)));
00055 
00056 #endif
00057 
00058 #if defined(WISPERS_HAVE_GET_MEMUSAGE)
00059 
00060 bool get_memusage(const unsigned int pid, memusage & usage);
00061 
00062 #endif
00063 
00064 __END_NS_SSRC_WSPR_UTILITY
00065 
00066 #endif

Savarese Software Research Corporation
Copyright © 2006-2011 Savarese Software Research Corporation. All rights reserved.