Skip to content

Instantly share code, notes, and snippets.

@dantleech
Created August 21, 2015 15:11
Show Gist options
  • Select an option

  • Save dantleech/0b61b1d14443a7f7b4dd to your computer and use it in GitHub Desktop.

Select an option

Save dantleech/0b61b1d14443a7f7b4dd to your computer and use it in GitHub Desktop.
Tabular configuration for generating tables/reports from XML document
{
"classes": {
"deviation": [
[ "printf", { "format": "%.2f%%" } ],
[ "balance" ]
],
"memory": [
[ "printf", { "format": "%d<comment>b</comment>" }]
],
"rps": [
[ "number", { "decimal_places": 2 }],
[ "printf", { "format": "%s<comment>rps</comment>" }]
],
"time": [
[ "number", { "decimal_places": 2 }],
[ "printf", { "format": "%s<comment>\u03bcs</comment>" }]
]
},
"rows": [
{
"cells": {
"benchmark": {
"expr": "class_name(string(ancestor-or-self::benchmark/@class))"
},
"subject": {
"expr": "string(ancestor-or-self::subject/@name)"
},
"group": {
"expr": "string(ancestor-or-self::group/@name)"
},
"params": {
"expr": "parameters_to_json(ancestor-or-self::variant/parameter)"
},
"revs": {
"expr": "number(descendant-or-self::iteration/@revs)"
},
"iter": {
"expr": "count(descendant-or-self::iteration/preceding-sibling::*)"
},
"time": {
"class": "time",
"expr": "number(descendant-or-self::iteration/@time) div sum(descendant-or-self::iteration/@revs)"
},
"time_net": {
"class": "time",
"expr": "number(descendant-or-self::iteration/@time)"
},
"memory": {
"class": "memory",
"expr": "number(descendant-or-self::iteration/@memory)"
},
"rps": {
"class": "rps",
"expr": "(1000000 div number(descendant-or-self::iteration//@time)) * number(descendant-or-self::iteration/@revs)"
},
"deviation": {
"class": "deviation",
"expr": "deviation(min(//@time), number(descendant-or-self::iteration/@time))"
}
},
"with_query": "//iteration"
},
{
"cells": {
"deviation": {
"literal": "<info><< {{ row.item }}</info>"
},
"{{ cell.item }}": {
"literal": "<comment>--</comment>",
"with_items": [
"benchmark",
"subject",
"group",
"params",
"iter"
]
},
"{{ cell.col }}": {
"expr": "{{ row.item }}(//group[@name=\"_default\"]//cell[@name=\"{{ cell.col }}\"])",
"pass": 1,
"class": "{{ cell.class }}",
"with_items": [
{
"col": "memory",
"class": "memory"
},
{
"col": "revs",
"class": null
},
{
"col": "time",
"class": "time"
},
{
"col": "time_net",
"class": "time"
},
{
"col": "rps",
"class": "rps"
}
]
}
},
"group": "footer",
"with_items": [ "average" ]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment