Merge pull request #7064 from birarda/integrate-new-hrtf

cleanup new AM percentage stats in DS
This commit is contained in:
Seth Alves 2016-02-10 14:21:42 -08:00
commit 66584c8e13
5 changed files with 37 additions and 9 deletions

View file

@ -489,6 +489,15 @@ void AudioMixer::removeHRTFsForFinishedInjector(const QUuid& streamID) {
}
}
QString AudioMixer::percentageForMixStats(int counter) {
if (_totalMixes > 0) {
float mixPercentage = (float(counter) / _totalMixes) * 100.0f;
return QString::number(mixPercentage, 'f', 2);
} else {
return QString("0.0");
}
}
void AudioMixer::sendStatsPacket() {
static QJsonObject statsObject;
@ -499,11 +508,11 @@ void AudioMixer::sendStatsPacket() {
statsObject["avg_listeners_per_frame"] = (float) _sumListeners / (float) _numStatFrames;
QJsonObject mixStats;
mixStats["%_hrtf_mixes"] = (_totalMixes > 0) ? (_hrtfRenders / _totalMixes) * 100.0f : 0;
mixStats["%_hrtf_silent_mixes"] = (_totalMixes > 0) ? (_hrtfSilentRenders / _totalMixes) * 100.0f : 0;
mixStats["%_hrtf_struggle_mixes"] = (_totalMixes > 0) ? (_hrtfStruggleRenders / _totalMixes) * 100.0f : 0;
mixStats["%_manual_stereo_mixes"] = (_totalMixes > 0) ? (_manualStereoMixes / _totalMixes) * 100.0f : 0;
mixStats["%_manual_echo_mixes"] = (_totalMixes > 0) ? (_manualEchoMixes / _totalMixes) * 100.0f : 0;
mixStats["%_hrtf_mixes"] = percentageForMixStats(_hrtfRenders);
mixStats["%_hrtf_silent_mixes"] = percentageForMixStats(_hrtfSilentRenders);
mixStats["%_hrtf_struggle_mixes"] = percentageForMixStats(_hrtfStruggleRenders);
mixStats["%_manual_stereo_mixes"] = percentageForMixStats(_manualStereoMixes);
mixStats["%_manual_echo_mixes"] = percentageForMixStats(_manualEchoMixes);
mixStats["total_mixes"] = _totalMixes;
mixStats["avg_mixes_per_block"] = _totalMixes / _numStatFrames;

View file

@ -71,6 +71,8 @@ private:
void perSecondActions();
QString percentageForMixStats(int counter);
bool shouldMute(float quietestFrame);
void parseSettingsObject(const QJsonObject& settingsObject);

View file

@ -92,6 +92,12 @@ tr.new-row {
background-color: #dff0d8;
}
.graphable-stat {
text-align: center;
color: #5286BC;
cursor: pointer;
}
.highchart-modal .modal-dialog {
width: 650px;
}

View file

@ -5,10 +5,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="/stats/css/json.human.css" rel="stylesheet" media="screen">
<link href="/css/style.css" rel="stylesheet" media="screen">
<link href="/css/sweetalert.css" rel="stylesheet" media="screen">
<link href="/css/bootstrap-switch.min.css" rel="stylesheet" media="screen">
<link href="/stats/css/json.human.css" rel="stylesheet" media="screen">
</head>
<body>

View file

@ -1,5 +1,5 @@
$(document).ready(function(){
var currentHighchart;
// setup a function to grab the nodeStats
@ -17,12 +17,22 @@ $(document).ready(function(){
var stats = JsonHuman.format(json);
$('#stats-container').html(stats);
// add the clickable class to anything that looks like a number
$('.jh-value span').each(function(val){
console.log(val);
if (!isNaN($(this).text())) {
// this looks like a number - give it the clickable class so we can get graphs for it
$(this).addClass('graphable-stat');
}
});
if (currentHighchart) {
// get the current time to set with the point
var x = (new Date()).getTime();
// get the last value using underscore-keypath
var y = _(json).valueForKeyPath(graphKeypath);
var y = Number(_(json).valueForKeyPath(graphKeypath));
// start shifting the chart once we hit 20 data points
var shift = currentHighchart.series[0].data.length > 20;
@ -91,7 +101,7 @@ $(document).ready(function(){
}
// handle clicks on numerical values - this lets the user show a line graph in a modal
$('#stats-container').on('click', '.jh-type-number', function(){
$('#stats-container').on('click', '.graphable-stat', function(){
graphKeypath = $(this).data('keypath');
// setup the new graph modal