[Ns-developers] [ns3] Statistical framework (draft)
Mathieu Lacage
mathieu.lacage at sophia.inria.fr
Wed May 14 08:56:17 PDT 2008
hi joe,
comments inline below.
On Wed, 2008-05-14 at 01:16 -0400, Joseph Kopena wrote:
> Hi Vincent, everybody,
>
> Sorry for some delay getting back to this, I've been traveling the
> past few days. On the upside, that meant a good chunk of airport time
> for coding.
>
> I've posted a repo at [1] that drafts some of my conception of the
> stat framework. Here's the basic ideas:
First, a couple of style details:
- PlainTextStatFramework uses multiple inheritance: we have worked
pretty hard to never do this in ns-3 so, it would be nice to keep on
doing this. A simple way to avoid this would be to use a
Callback<void,std::string,uint32_t> instead of the StatOutputCallback
class.
- most of your class member variables seem to be protected by default.
private would be a better default for most of them and protected should
be used when you really cannot do otherwise.
> - A stat framework object provides functionality to create stat
> objects and specifies an output callback.
> - Stat objects track different generic statistics and are updated by
> events, trace firings, etc.
> - Each stat object uses the callback to give its output to the
> specific framework being used, which in turn renders that data (e.g.,
> as plain text or XML).
The main use-case you seem to be concerned with is providing a way to
asbtract the storage of the data/statistics to allow the user to choose
between multiple storage formats: text, xml, database. Am I right ?
So, if I look at your system, you have:
- StatFramework: abtract the storage system. Subclasses implement
serialization to the right storage format.
- StatCalculator: abstract the type of statistics being calculated.
Subclasses implement the actual statistics calculation.
If I understand the code correctly, you could presumably implement a
DataStatCalculator which would not perform and statistics calculation
and would just dump in the framework the raw data, right ?
It seems to me that it is also conceivable to implement something like a
GnuplotStatFramework, right ?
So, if I am not too mistaken above, here are a few comments:
- a better name for StatFramework might be DataStorage or something
similar to outline its relationship to data storage format.
- I would tend to move out Counter creation out of the StatFramework
base class and make the StatCalculator constructor take a pointer to its
associated StatFramework instead: allows you to add new subclasses to
StatCalculator without patching StatFramework
- the primitive data type you manipulate is a uint32_t
(CounterStat::Update and StatOutputCallback::OutputSingleton): I think
that it is important to support other types such a double. Are there
other types beyond uint32_t and double that we want to support ?
uint64_t ? Time ? We need to have a list.
There are probably a couple of other comments I will think about later
but I thought that these would get you started :)
> Note that unlike most ns-3 WIPs, this is currently setup externally,
> not as a branch of ns-3-dev. This was mostly done to reduce compile
> (make faster than waf?) and link time, as well as ease eventual
> merging. To compile, just run make in the root directory. It'll
> expect the env variable NS3_LIB_DIR to be set. This is usually the
> build/debug/ subdirectory of your ns-3 repository, e.g. for me it's
> usually export NS3_LIB_DIR=/opt/ns-3-dev/build/debug/.
I understand that it is probably a matter of taste, but moving your
headers to src/stats would be more in line with the "ns-3 way" and would
make it easier for me to review the code (because I don't have to cd
constantly to move from headers to implementations).
regards,
Mathieu
More information about the Ns-developers
mailing list