mirror of https://gitee.com/bigwinds/arangodb
higher precision for statistics values, added "sum" attribute for statistics
This commit is contained in:
parent
2355ce0420
commit
b61aac7879
|
@ -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().
|
* made "limit" an optional parameter in AQL function NEAR().
|
||||||
limit can now be either omitted completely, or set to 0. If so, an internal
|
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.
|
default value (currently 100) will be applied for the limit.
|
||||||
|
|
|
@ -300,12 +300,13 @@ actions.defineHttp({
|
||||||
/// stored in the attribute of the same name.
|
/// stored in the attribute of the same name.
|
||||||
///
|
///
|
||||||
/// In case of a distribution, the returned object contains the total count in
|
/// 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
|
/// @RESTRETURNCODES
|
||||||
///
|
///
|
||||||
/// @RESTRETURNCODE{200}
|
/// @RESTRETURNCODE{200}
|
||||||
/// Statistics was returned successfully.
|
/// Statistics were returned successfully.
|
||||||
///
|
///
|
||||||
/// @EXAMPLES
|
/// @EXAMPLES
|
||||||
///
|
///
|
||||||
|
|
|
@ -85,16 +85,17 @@ namespace triagens {
|
||||||
|
|
||||||
struct StatisticsDistribution {
|
struct StatisticsDistribution {
|
||||||
StatisticsDistribution ()
|
StatisticsDistribution ()
|
||||||
: _count(0), _cuts(), _counts() {
|
: _count(0), _total(0.0), _cuts(), _counts() {
|
||||||
}
|
}
|
||||||
|
|
||||||
StatisticsDistribution (StatisticsVector const& dist)
|
StatisticsDistribution (StatisticsVector const& dist)
|
||||||
: _count(0), _cuts(dist._value), _counts() {
|
: _count(0), _total(0.0), _cuts(dist._value), _counts() {
|
||||||
_counts.resize(_cuts.size() + 1);
|
_counts.resize(_cuts.size() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addFigure (double value) {
|
void addFigure (double value) {
|
||||||
++_count;
|
++_count;
|
||||||
|
_total += value;
|
||||||
|
|
||||||
std::vector<double>::iterator i = _cuts.begin();
|
std::vector<double>::iterator i = _cuts.begin();
|
||||||
std::vector<uint64_t>::iterator j = _counts.begin();
|
std::vector<uint64_t>::iterator j = _counts.begin();
|
||||||
|
@ -110,6 +111,7 @@ namespace triagens {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t _count;
|
uint64_t _count;
|
||||||
|
double _total;
|
||||||
std::vector<double> _cuts;
|
std::vector<double> _cuts;
|
||||||
std::vector<uint64_t> _counts;
|
std::vector<uint64_t> _counts;
|
||||||
};
|
};
|
||||||
|
|
|
@ -418,7 +418,7 @@ double TRI_StatisticsTime () {
|
||||||
#else
|
#else
|
||||||
|
|
||||||
double TRI_StatisticsTime () {
|
double TRI_StatisticsTime () {
|
||||||
return (double)(time(0));
|
return TRI_microtime();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -261,6 +261,7 @@ static void FillDistribution (v8::Handle<v8::Object> list,
|
||||||
StatisticsDistribution const& dist) {
|
StatisticsDistribution const& dist) {
|
||||||
v8::Handle<v8::Object> result = v8::Object::New();
|
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));
|
result->Set(TRI_V8_SYMBOL("count"), v8::Number::New(dist._count));
|
||||||
|
|
||||||
v8::Handle<v8::Array> counts = v8::Array::New(dist._counts.size());
|
v8::Handle<v8::Array> counts = v8::Array::New(dist._counts.size());
|
||||||
|
|
Loading…
Reference in New Issue