00001 #ifndef ITEM_STATISTICS_IMPLEMENTATION_FILE 00002 #define ITEM_STATISTICS_IMPLEMENTATION_FILE 00003 00004 /*****************************************************************************\ 00005 * * 00006 * Name : item_statistics * 00007 * Author : Chris Koeritz * 00008 * * 00009 ******************************************************************************* 00010 * Copyright (c) 2000-$now By Author. This program is free software; you can * 00011 * redistribute it and/or modify it under the terms of the GNU General Public * 00012 * License as published by the Free Software Foundation; either version 2 of * 00013 * the License or (at your option) any later version. This is online at: * 00014 * http://www.fsf.org/copyleft/gpl.html * 00015 * Please send any updates to: fred@gruntose.com * 00016 \*****************************************************************************/ 00017 00018 #include "item_statistics.h" 00019 00020 #include <basis/function.h> 00021 #include <basis/istring.h> 00022 #include <mathematics/averager.cpp> 00023 00024 istring item_statistics::text_form() const 00025 { 00026 istring to_return; 00027 to_return += "entered at {"; 00028 to_return += adjusted_representation(entry); 00029 to_return += "}, exited at {"; 00030 to_return += adjusted_representation(exit); 00031 to_return += istring(istring::SPRINTF, "}, based on %d activations, " 00032 "average was %d ms.", durations.samples(), durations.average()); 00033 return to_return; 00034 } 00035 00036 istring item_statistics::adjusted_representation 00037 (const guarded_value<time_stamp> &to_show) const 00038 { 00039 if (!to_show.initialized()) return "invalid"; 00040 else return time_stamp(to_show).text_form(); 00041 } 00042 00043 00044 #endif //ITEM_STATISTICS_IMPLEMENTATION_FILE 00045
1.5.1