1
0
Fork 0

higher precision for statistics values, added "sum" attribute for statistics

This commit is contained in:
Jan Steemann 2013-04-22 13:24:08 +02:00
parent 2355ce0420
commit b61aac7879
5 changed files with 15 additions and 6 deletions

View File

@ -1,6 +1,11 @@
v1.3.0-alpha1 (XXXX-XX-XX)
v1.3.0-alpha2 (XXXX-XX-XX)
--------------------------
* added more precision for requests statistics figures
* added "sum" attribute for individual statistics results in statistics API
at /_admin/statistics
* made "limit" an optional parameter in AQL function NEAR().
limit can now be either omitted completely, or set to 0. If so, an internal
default value (currently 100) will be applied for the limit.

View File

@ -300,12 +300,13 @@ actions.defineHttp({
/// stored in the attribute of the same name.
///
/// In case of a distribution, the returned object contains the total count in
/// `count` and the distribution list in `counts`.
/// `count` and the distribution list in `counts`. The sum (or total) of the
/// individual values is returned in `sum`.
///
/// @RESTRETURNCODES
///
/// @RESTRETURNCODE{200}
/// Statistics was returned successfully.
/// Statistics were returned successfully.
///
/// @EXAMPLES
///

View File

@ -85,16 +85,17 @@ namespace triagens {
struct StatisticsDistribution {
StatisticsDistribution ()
: _count(0), _cuts(), _counts() {
: _count(0), _total(0.0), _cuts(), _counts() {
}
StatisticsDistribution (StatisticsVector const& dist)
: _count(0), _cuts(dist._value), _counts() {
: _count(0), _total(0.0), _cuts(dist._value), _counts() {
_counts.resize(_cuts.size() + 1);
}
void addFigure (double value) {
++_count;
_total += value;
std::vector<double>::iterator i = _cuts.begin();
std::vector<uint64_t>::iterator j = _counts.begin();
@ -110,6 +111,7 @@ namespace triagens {
}
uint64_t _count;
double _total;
std::vector<double> _cuts;
std::vector<uint64_t> _counts;
};

View File

@ -418,7 +418,7 @@ double TRI_StatisticsTime () {
#else
double TRI_StatisticsTime () {
return (double)(time(0));
return TRI_microtime();
}
#endif

View File

@ -261,6 +261,7 @@ static void FillDistribution (v8::Handle<v8::Object> list,
StatisticsDistribution const& dist) {
v8::Handle<v8::Object> result = v8::Object::New();
result->Set(TRI_V8_SYMBOL("sum"), v8::Number::New(dist._total));
result->Set(TRI_V8_SYMBOL("count"), v8::Number::New(dist._count));
v8::Handle<v8::Array> counts = v8::Array::New(dist._counts.size());