/* Copyright 2015 Pierre Ossman <ossman@cendio.se> for Cendio AB
+ * Copyright (C) 2015 D. R. Commander. All Rights Reserved.
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
CConn(const char *filename);
~CConn();
- double getRatio();
+ void getStats(double& ratio, unsigned long long& bytes,
+ unsigned long long& rawEquivalent);
virtual void setDesktopSize(int w, int h);
virtual void setCursor(int, int, const rfb::Point&, void*, void*);
public:
Manager(class rfb::SConnection *conn);
- double getRatio();
+ void getStats(double&, unsigned long long&, unsigned long long&);
};
class SConn : public rfb::SConnection {
void writeUpdate(const rfb::UpdateInfo& ui, const rfb::PixelBuffer* pb);
- double getRatio();
+ void getStats(double&, unsigned long long&, unsigned long long&);
virtual void setAccessRights(AccessRights ar);
delete decoders[i];
}
-double CConn::getRatio()
+void CConn::getStats(double& ratio, unsigned long long& bytes,
+ unsigned long long& rawEquivalent)
{
- return sc->getRatio();
+ sc->getStats(ratio, bytes, rawEquivalent);
}
void CConn::setDesktopSize(int w, int h)
{
}
-double Manager::getRatio()
+void Manager::getStats(double& ratio, unsigned long long& encodedBytes,
+ unsigned long long& rawEquivalent)
{
StatsVector::iterator iter;
unsigned long long bytes, equivalent;
}
}
- return (double)equivalent / bytes;
+ ratio = (double)equivalent / bytes;
+ encodedBytes = bytes;
+ rawEquivalent = equivalent;
}
SConn::SConn()
manager->writeUpdate(ui, pb, NULL);
}
-double SConn::getRatio()
+void SConn::getStats(double& ratio, unsigned long long& bytes,
+ unsigned long long& rawEquivalent)
{
- return manager->getRatio();
+ manager->getStats(ratio, bytes, rawEquivalent);
}
void SConn::setAccessRights(AccessRights ar)
{
}
-static double runTest(const char *fn, double *ratio)
+static double runTest(const char *fn, double& ratio, unsigned long long& bytes,
+ unsigned long long& rawEquivalent)
{
CConn *cc;
double time;
}
time = cc->encodeTime;
- *ratio = cc->getRatio();
+ cc->getStats(ratio, bytes, rawEquivalent);
delete cc;
double times[runCount], dev[runCount];
double median, meddev, ratio;
+ unsigned long long bytes, equivalent;
fn = NULL;
for (i = 1; i < argc; i++) {
}
// Warmup
- runTest(fn, &ratio);
+ runTest(fn, ratio, bytes, equivalent);
// Multiple runs to get a good average
for (i = 0; i < runCount; i++)
- times[i] = runTest(fn, &ratio);
+ times[i] = runTest(fn, ratio, bytes, equivalent);
// Calculate median and median deviation
sort(times, runCount);
meddev = dev[runCount / 2];
printf("CPU time: %g s (+/- %g %)\n", median, meddev);
+ printf("Encoded bytes: %lld\n", bytes);
+ printf("Raw equivalent bytes: %lld\n", equivalent);
printf("Ratio: %g\n", ratio);
return 0;