Skip to content

Instantly share code, notes, and snippets.

@diamondo25
Last active April 27, 2019 11:25
Show Gist options
  • Save diamondo25/9584866a0d599292f35a5fad09664aa5 to your computer and use it in GitHub Desktop.
Save diamondo25/9584866a0d599292f35a5fad09664aa5 to your computer and use it in GitHub Desktop.
CPU Benchmark data extractor
function nameToShortName(name) {
var x = name.match(/(.* ([EiWA][0-9]+[^ ]+).*)/);
if (x != null) return x[2];
x = name.match(/(.* ([A-Za-z-]*[0-9]{3,}[A-Za-z-]*)( .*|$))/);
if (x != null) return x[2];
return name;
}
var results = {};
$('#single, #mark, #value').each((id, graph) => {
var graph_name = graph.id;
var r = {};
$(graph).find('tr').each((x, row) => {
var clickable_name = $(row).find('a');
if (clickable_name.length == 0) return;
var full_name = clickable_name[0].innerText.trim();
var name = nameToShortName(full_name);
var value_field = $(row).find('td.value');
if (value_field.length == 0) {
console.log('Unable to find value for', row);
return;
}
var graph_value = value_field[0].innerText.trim();
console.log(graph_name, name, graph_value);
if (!(name in r)) {
r[name] = {};
}
r[name][full_name] = graph_value;
});
results[graph_name] = r;
});
results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment