stats: stick the distribution's fancy parameter into the parameters structure.
This commit is contained in:
parent
e19fd1d521
commit
244c2a517a
3 changed files with 22 additions and 26 deletions
|
@ -257,8 +257,6 @@ struct DistData
|
|||
Counter sum;
|
||||
Counter squares;
|
||||
Counter samples;
|
||||
|
||||
bool fancy;
|
||||
};
|
||||
|
||||
class DistInfoBase : public Info
|
||||
|
@ -1419,8 +1417,9 @@ class DistStor
|
|||
Counter bucket_size;
|
||||
/** The number of buckets. Equal to (max-min)/bucket_size. */
|
||||
size_type buckets;
|
||||
};
|
||||
|
||||
enum { fancy = false };
|
||||
};
|
||||
|
||||
private:
|
||||
/** The minimum value to track. */
|
||||
|
@ -1556,10 +1555,10 @@ class DistStor
|
|||
class FancyStor
|
||||
{
|
||||
public:
|
||||
struct Params : public StorageParams {};
|
||||
|
||||
public:
|
||||
struct Params : public StorageParams
|
||||
{
|
||||
enum { fancy = true };
|
||||
};
|
||||
|
||||
private:
|
||||
/** The current sum. */
|
||||
|
@ -1632,10 +1631,10 @@ class FancyStor
|
|||
class AvgFancy
|
||||
{
|
||||
public:
|
||||
struct Params : public StorageParams {};
|
||||
|
||||
public:
|
||||
struct Params : public StorageParams
|
||||
{
|
||||
enum { fancy = true };
|
||||
};
|
||||
|
||||
private:
|
||||
/** Current total. */
|
||||
|
@ -1765,7 +1764,6 @@ class DistBase : public InfoAccess
|
|||
void
|
||||
update(DistInfoBase *base)
|
||||
{
|
||||
base->data.fancy = Storage::fancy;
|
||||
data()->update(info(), base->data);
|
||||
}
|
||||
|
||||
|
@ -1881,7 +1879,6 @@ class VectorDistBase : public InfoAccess
|
|||
size_type size = this->size();
|
||||
base->data.resize(size);
|
||||
for (off_type i = 0; i < size; ++i) {
|
||||
base->data[i].fancy = Storage::fancy;
|
||||
data(i)->update(info(), base->data[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -583,8 +583,8 @@ MySql::configure(const DistInfoBase &info)
|
|||
if (!configure(info, "DIST"))
|
||||
return;
|
||||
|
||||
if (!info.data.fancy) {
|
||||
const Params *params = safe_cast<const Params *>(info.storageParams);
|
||||
if (!params->fancy) {
|
||||
stat.size = params->buckets;
|
||||
stat.min = params->min;
|
||||
stat.max = params->max;
|
||||
|
@ -599,8 +599,8 @@ MySql::configure(const VectorDistInfoBase &info)
|
|||
if (!configure(info, "VECTORDIST"))
|
||||
return;
|
||||
|
||||
if (!info.data[0].fancy) {
|
||||
const Params *params = safe_cast<const Params *>(info.storageParams);
|
||||
if (!params->fancy) {
|
||||
stat.size = params->buckets;
|
||||
stat.min = params->min;
|
||||
stat.max = params->max;
|
||||
|
|
|
@ -673,12 +673,11 @@ Text::visit(const DistInfoBase &info)
|
|||
print.squares = data.squares;
|
||||
print.samples = data.samples;
|
||||
|
||||
print.fancy = data.fancy;
|
||||
|
||||
if (!data.fancy) {
|
||||
const DistStor::Params *params =
|
||||
safe_cast<const DistStor::Params *>(info.storageParams);
|
||||
|
||||
print.fancy = params->fancy;
|
||||
if (!params->fancy) {
|
||||
print.min = params->min;
|
||||
print.max = params->max;
|
||||
print.bucket_size = params->bucket_size;
|
||||
|
@ -716,11 +715,11 @@ Text::visit(const VectorDistInfoBase &info)
|
|||
print.squares = info.data[i].squares;
|
||||
print.samples = info.data[i].samples;
|
||||
|
||||
print.fancy = info.data[i].fancy;
|
||||
if (!print.fancy) {
|
||||
const DistStor::Params *params =
|
||||
safe_cast<const DistStor::Params *>(info.storageParams);
|
||||
|
||||
print.fancy = params->fancy;
|
||||
if (!params->fancy) {
|
||||
print.min = params->min;
|
||||
print.max = params->max;
|
||||
print.bucket_size = params->bucket_size;
|
||||
|
|
Loading…
Reference in a new issue