1 
2 /* Web Polygraph       http://www.web-polygraph.org/
3  * Copyright 2003-2011 The Measurement Factory
4  * Licensed under the Apache License, Version 2.0 */
5 
6 #include "base/polygraph.h"
7 
8 //#include "xml/XmlText.h"
9 //#include "xml/XmlParagraph.h"
10 #include "loganalyzers/Stex.h"
11 #include "loganalyzers/ReportBlob.h"
12 #include "loganalyzers/PhaseInfo.h"
13 #include "loganalyzers/LoadStexes.h"
14 
15 /* SideLoadStex */
16 
SideLoadStex(const String & aKey,const String & aName,StatPtr aRate,StatPtr aBwidth)17 SideLoadStex::SideLoadStex(const String &aKey, const String &aName, StatPtr aRate, StatPtr aBwidth):
18 	LoadStex(aKey, aName), theRateStats(aRate), theBwidthStats(aBwidth) {
19 }
20 
rate(const StatIntvlRec & rec) const21 double SideLoadStex::rate(const StatIntvlRec &rec) const {
22 	return (rec.*theRateStats)();
23 }
24 
bwidth(const StatIntvlRec & rec) const25 double SideLoadStex::bwidth(const StatIntvlRec &rec) const {
26 	return (rec.*theBwidthStats)();
27 }
28 
29 
30 /* TmSzLoadStex */
31 
TmSzLoadStex(const Stex * aStex)32 TmSzLoadStex::TmSzLoadStex(const Stex *aStex):
33 	LoadStex(aStex->key(), aStex->name()), theStex(aStex) {
34 }
35 
rate(const StatIntvlRec & rec) const36 double TmSzLoadStex::rate(const StatIntvlRec &rec) const {
37 	return perDuration(theStex->trace(rec)->count(), rec);
38 }
39 
bwidth(const StatIntvlRec & rec) const40 double TmSzLoadStex::bwidth(const StatIntvlRec &rec) const {
41 	return perDuration(theStex->trace(rec)->size().sum(), rec);
42 }
43 
44 
45 /* ProtoSideLoadStex */
46 
ProtoSideLoadStex(const String & aKey,const String & aName,ProtoPtr aProto,StatPtr aRate,StatPtr aBwidth)47 ProtoSideLoadStex::ProtoSideLoadStex(const String &aKey, const String &aName,
48 	ProtoPtr aProto, StatPtr aRate, StatPtr aBwidth):
49 	LoadStex(aKey, aName), theProto(aProto),
50 	theRateStats(aRate), theBwidthStats(aBwidth) {
51 }
52 
rate(const StatIntvlRec & rec) const53 double ProtoSideLoadStex::rate(const StatIntvlRec &rec) const {
54 	return (rec.*theProto.*theRateStats)(rec.theDuration);
55 }
56 
bwidth(const StatIntvlRec & rec) const57 double ProtoSideLoadStex::bwidth(const StatIntvlRec &rec) const {
58 	return (rec.*theProto.*theBwidthStats)(rec.theDuration);
59 }
60