Exemplo n.º 1
0
def gen_html_cpu(cpu):
    lev = tldata.level_order(data)
    graph = ""
    for name in lev:
        opts = {
            "title": name + " " + cpu,
            "width": 1000,
            "height": 180,
            #"xlabel": "time",
        }

        if name in data.metrics:
            unit = gen_level.get_unit(list(data.levels[name])[0])
            if unit:
                opts["ylabel"] = unit
        else:
            opts["stackedGraph"] = 1
            opts["stackedGraphNaNFill"] = "none"
            opts["ylabel"] = "% CPU time"
            unit = '%'
        if unit == '%':
            opts["valueRange"] = [-5, 110]
        graph += T("""

<div id="d_${cpu}_$name" class="disp"></div>

<script type="text/javascript">
    i = num_graphs++
    goptions[i] = $opts
    goptions[i].highlightCallback = function(e, x, pts, row) {
        hilight_help(e, x, pts, row, help_$jname)
    }
    goptions[i].unhighlightCallback = unhilight_help
    goptions[i].drawCallback = draw_graph
    graphs[i] = new Dygraph(document.getElementById("d_${cpu}_$name"), "$cpu.$file.csv", goptions[i])
    goptions[i]["file"] = "$cpu.$file.csv"
</script>
                """).substitute({
            "name": name,
            "jname": jsname(name),
            "file": name,
            "cpu": cpu,
            "opts": opts
        })
    return graph
Exemplo n.º 2
0
def gen_html_cpu(cpu):
    lev = tldata.level_order(data)
    graph = ""
    for name in lev:
        opts = {
            "title": name + " " + cpu,
            "width": 1000,
            "height": 180,
            #"xlabel": "time",
        }

        if name in data.metrics:
            unit = gen_level.get_unit(list(data.levels[name])[0])
            if unit:
                opts["ylabel"] = unit
        else:
            opts["stackedGraph"] = 1
            opts["stackedGraphNaNFill"] = "none"
            opts["ylabel"] = "% CPU time"
            unit = '%'
        if unit == '%':
            opts["valueRange"] = [-5, 110]
        graph += T("""

<div id="d_${cpu}_$name" class="disp"></div>

<script type="text/javascript">
    i = num_graphs++
    goptions[i] = $opts
    goptions[i].highlightCallback = function(e, x, pts, row) {
        hilight_help(e, x, pts, row, help_$jname)
    }
    goptions[i].unhighlightCallback = unhilight_help
    goptions[i].drawCallback = draw_graph
    graphs[i] = new Dygraph(document.getElementById("d_${cpu}_$name"), "$cpu.$file.csv", goptions[i])
    goptions[i]["file"] = "$cpu.$file.csv"
</script>
                """).substitute({"name": name, "jname": jsname(name), "file": name, "cpu": cpu, "opts": opts})
    return graph