![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /******************************************************************************* 00002 * This file is part of openWNS (open Wireless Network Simulator) 00003 * _____________________________________________________________________________ 00004 * 00005 * Copyright (C) 2004-2007 00006 * Chair of Communication Networks (ComNets) 00007 * Kopernikusstr. 16, D-52074 Aachen, Germany 00008 * phone: ++49-241-80-27910, 00009 * fax: ++49-241-80-22242 00010 * email: info@openwns.org 00011 * www: http://www.openwns.org 00012 * _____________________________________________________________________________ 00013 * 00014 * openWNS is free software; you can redistribute it and/or modify it under the 00015 * terms of the GNU Lesser General Public License version 2 as published by the 00016 * Free Software Foundation; 00017 * 00018 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY 00019 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 00020 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00021 * details. 00022 * 00023 * You should have received a copy of the GNU Lesser General Public License 00024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00025 * 00026 ******************************************************************************/ 00027 00028 #include <WNS/events/scheduler/Monitor.hpp> 00029 00030 using namespace wns::events::scheduler; 00031 00032 Monitor::Monitor(const wns::pyconfig::View& configuration) : 00033 Observer<INotification>(), 00034 logger_(configuration.get("logger")), 00035 processedEvents_(0), 00036 canceledEvents_(0), 00037 scheduledNowEvents_(0), 00038 scheduledEvents_(0), 00039 scheduledDelayEvents_(0) 00040 { 00041 } 00042 00043 void 00044 Monitor::logStatistics() 00045 { 00046 MESSAGE_BEGIN(QUIET, logger_, m, "\nStatistics for event scheduler:\n"); 00047 long long int totalAddedEvents = scheduledNowEvents_ + scheduledEvents_ + scheduledDelayEvents_; 00048 m << "--------------------------------------------------------------------------\n" 00049 << "processed events: " << processedEvents_ << "\n" 00050 << "added events: " << totalAddedEvents << "\n" 00051 << " - delay: " << scheduledDelayEvents_ << "\n" 00052 << " - now: " << scheduledNowEvents_ << "\n" 00053 << " - absolute time: " << scheduledEvents_ << "\n" 00054 << "canceled events: " << canceledEvents_ << "\n"; 00055 MESSAGE_END(); 00056 00057 } 00058 00059 void 00060 Monitor::doOnProcessOneEvent() 00061 { 00062 MESSAGE_SINGLE(VERBOSE, logger_, "Processing next event"); 00063 ++processedEvents_; 00064 } 00065 00066 void 00067 Monitor::doOnCancelEvent() 00068 { 00069 MESSAGE_SINGLE(VERBOSE, logger_, "Canceling event"); 00070 ++canceledEvents_; 00071 } 00072 00073 void 00074 Monitor::doOnSchedule() 00075 { 00076 MESSAGE_SINGLE(VERBOSE, logger_, "Scheduling an event for an absolute point in time"); 00077 ++scheduledEvents_; 00078 } 00079 00080 void 00081 Monitor::doOnScheduleDelay() 00082 { 00083 MESSAGE_SINGLE(VERBOSE, logger_, "Scheduling an event with delay"); 00084 ++scheduledDelayEvents_; 00085 } 00086 00087 void 00088 Monitor::doOnScheduleNow() 00089 { 00090 MESSAGE_SINGLE(VERBOSE, logger_, "Scheduling an event for 'now'"); 00091 ++scheduledNowEvents_; 00092 } 00093 00094 void 00095 Monitor::doOnAddEvent() 00096 { 00097 }
1.5.5