Fix Tairent::Main::TorrentManager::save() method's comment.
[tairent.git] / src / main / ratemeasurer.h
blobd1af32dea5e0b9161a335f72a78de23199841e1e
1 /***************************************************************************
2 * *
3 * Copyright (C) 2006 David Brodsky *
4 * *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License as *
7 * published by the Free Software Foundation and appearing *
8 * in the file LICENSE.GPL included in the packaging of this file. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
13 * General Public License for more details. *
14 * *
15 ***************************************************************************/
17 #ifndef _main_ratemeasurer_h
18 #define _main_ratemeasurer_h
20 namespace Tairent
23 namespace Main
26 /** \brief Class for measuring transfer rates.
28 class RateMeasurer
30 public:
31 /** Constructs a RateMeasurer object.
33 * \param p Period for measuring.
35 RateMeasurer(double p);
37 /** Destroys the object.
39 ~RateMeasurer();
41 /** Returns current measred rate.
43 double getRate();
45 /** Updates the rate with number of trasnferred bytes.
47 void update(unsigned int amount);
49 private:
50 /** Time of the last update.
52 double lastTime;
54 /** Counting period.
56 double period;
58 /** Current rate.
60 double rate;
62 /** Period's start time.
64 double startTime;
67 }; // namespace Main
69 }; // namespace Tairent
71 #endif
73 // vim: ai sw=4 ts=4 noet fdm=marker