libGizmod/GizmoEventCPUUsage.cpp

Go to the documentation of this file.
00001 
00012 /*
00013   
00014   Copyright (c) 2007, Tim Burrell
00015   Licensed under the Apache License, Version 2.0 (the "License");
00016   you may not use this file except in compliance with the License.
00017   You may obtain a copy of the License at 
00018 
00019         http://www.apache.org/licenses/LICENSE-2.0
00020 
00021   Unless required by applicable law or agreed to in writing, software
00022   distributed under the License is distributed on an "AS IS" BASIS,
00023   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00024   See the License for the specific language governing permissions and 
00025   limitations under the License. 
00026   
00027 */
00028 
00029 #include "GizmoEventCPUUsage.hpp"
00030 #include "../libH/Debug.hpp"
00031 #include "../libH/Exception.hpp"
00032 #include <boost/shared_ptr.hpp>
00033 
00034 using namespace std;
00035 using namespace boost;
00036 using namespace H;
00037 using namespace Gizmod;
00038 
00040 // Type Defs
00042 
00044 // Construction
00046 
00050 GizmoEventCPUUsage::GizmoEventCPUUsage() : GizmoEvent(GIZMO_EVENTCLASS_CPUUSAGE, false) {
00051 }
00052 
00056 GizmoEventCPUUsage::GizmoEventCPUUsage(std::vector< boost::shared_ptr<CPUUsageInfo> > const & Event, bool IsRemote) : GizmoEvent(GIZMO_EVENTCLASS_CPUUSAGE, IsRemote) {
00057         mEvent = Event;
00058 }
00059 
00063 GizmoEventCPUUsage::~GizmoEventCPUUsage() {
00064 }
00065 
00067 // Class Body
00069 
00074 double GizmoEventCPUUsage::getCPUUsage(size_t CPUIndex) const {
00075         if (CPUIndex < 0.0)
00076                 return 0.0;
00077         else if (CPUIndex >= mEvent.size())
00078                 return 0.0;
00079         return mEvent[CPUIndex]->Usage;
00080 }
00081 
00086 double GizmoEventCPUUsage::getCPUUsageAvg(size_t CPUIndex) const {
00087         if (CPUIndex < 0.0)
00088                 return 0.0;
00089         else if (CPUIndex >= mEvent.size())
00090                 return 0.0;
00091         return mEvent[CPUIndex]->Average;
00092 }
00093 
00098 size_t GizmoEventCPUUsage::getNumCPUs() const {
00099         return mEvent.size();
00100 }
00101 

Generated on Wed Nov 7 10:04:16 2007 for gizmod by  doxygen 1.5.3