-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added stats based classes and intergrated them with the factory and w…
…orkers
- Loading branch information
Janitha Karunaratne
committed
Mar 6, 2014
1 parent
3510557
commit a569eeb
Showing
10 changed files
with
413 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
#include <ev.h> | ||
|
||
#include "params.h" | ||
#include "events.h" | ||
#include "stats.h" | ||
|
||
#define DEBUG 1 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#include "stats.h" | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
#define NS_PER_S 1000000000 | ||
|
||
uint64_t timestamp_ns_now() { | ||
uint64_t nsec; | ||
timespec tspec; | ||
clock_gettime(CLOCK_REALTIME, &tspec); | ||
nsec = tspec.tv_sec * NS_PER_S + tspec.tv_nsec; | ||
return nsec; | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
StatsList::StatsList() { | ||
} | ||
|
||
StatsList::~StatsList() { | ||
} | ||
|
||
void StatsList::push(Stats *stats) { | ||
|
||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
Stats::Stats() { | ||
|
||
} | ||
|
||
Stats::~Stats() { | ||
|
||
} | ||
|
||
void Stats::print() { | ||
|
||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
TcpFactoryStats::TcpFactoryStats() | ||
: Stats() { | ||
} | ||
|
||
TcpFactoryStats::~TcpFactoryStats() { | ||
} | ||
|
||
void TcpFactoryStats::print() { | ||
|
||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
TcpWorkerStats::TcpWorkerStats() | ||
: Stats() { | ||
|
||
} | ||
|
||
TcpWorkerStats::~TcpWorkerStats() { | ||
|
||
} | ||
|
||
void TcpWorkerStats::print() { | ||
|
||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
TcpServerWorkerStats::TcpServerWorkerStats() | ||
: TcpWorkerStats() { | ||
|
||
} | ||
|
||
TcpServerWorkerStats::~TcpServerWorkerStats() { | ||
|
||
} | ||
|
||
void TcpServerWorkerStats::print() { | ||
|
||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
TcpClientWorkerStats::TcpClientWorkerStats() | ||
: TcpWorkerStats() { | ||
|
||
} | ||
|
||
TcpClientWorkerStats::~TcpClientWorkerStats() { | ||
|
||
} | ||
|
||
void TcpClientWorkerStats::print() { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
#ifndef STATS_H | ||
#define STATS_H | ||
|
||
#include <ctime> | ||
#include <cstdint> | ||
#include <list> | ||
|
||
#include <msgpack.hpp> | ||
|
||
uint64_t timestamp_ns_now(); | ||
|
||
class Stats; | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
class StatsList { | ||
private: | ||
std::list<Stats*> stats; | ||
public: | ||
StatsList(); | ||
virtual ~StatsList(); | ||
|
||
void push(Stats *stats); | ||
}; | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
class Stats { | ||
public: | ||
Stats(); | ||
virtual ~Stats(); | ||
|
||
virtual void print(); | ||
}; | ||
|
||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
class FactoryStats : public Stats { | ||
}; | ||
|
||
class TcpFactoryStats : public FactoryStats { | ||
public: | ||
uint64_t bytes_in; | ||
uint64_t bytes_out; | ||
uint64_t cumulative_count; | ||
|
||
TcpFactoryStats(); | ||
virtual ~TcpFactoryStats(); | ||
|
||
virtual void print(); | ||
}; | ||
|
||
class TcpServerFactoryStats : public TcpFactoryStats { | ||
}; | ||
|
||
class TcpClientFactoryStats : public TcpFactoryStats { | ||
}; | ||
|
||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
class TcpWorkerStats : public Stats { | ||
public: | ||
|
||
uint64_t readable_time; | ||
uint64_t writable_time; | ||
uint64_t close_time; | ||
|
||
uint64_t bytes_in; | ||
uint64_t bytes_out; | ||
|
||
TcpWorkerStats(); | ||
virtual ~TcpWorkerStats(); | ||
|
||
virtual void print(); | ||
}; | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
class TcpServerWorkerStats : public TcpWorkerStats { | ||
public: | ||
|
||
uint64_t established_time; | ||
|
||
TcpServerWorkerStats(); | ||
virtual ~TcpServerWorkerStats(); | ||
|
||
virtual void print(); | ||
}; | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
class TcpClientWorkerStats : public TcpWorkerStats { | ||
public: | ||
|
||
uint64_t connect_time; | ||
uint64_t established_time; | ||
|
||
TcpClientWorkerStats(); | ||
virtual ~TcpClientWorkerStats(); | ||
|
||
virtual void print(); | ||
}; | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
class TcpServerEchoStats : public TcpServerWorkerStats { | ||
}; | ||
|
||
class TcpClientEchoStats : public TcpClientWorkerStats { | ||
}; | ||
|
||
class TcpServerRawStats : public TcpServerWorkerStats { | ||
}; | ||
|
||
class TcpClientRawStats : public TcpClientWorkerStats { | ||
}; | ||
|
||
class TcpServerHttpStats : public TcpServerWorkerStats { | ||
}; | ||
|
||
class TcpClientHttpStats : public TcpClientWorkerStats { | ||
}; | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.