| 1 | <!doctype html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>PrimusVK: Profiling</title> |
| 5 | <meta charset='UTF-8'> |
| 6 | <script src="https://d3js.org/d3.v5.min.js"></script> |
| 7 | <script> |
| 8 | const prefix = "PrimusVK-profiling: "; |
| 9 | function loadData(){ |
| 10 | d3.text( "trace.txt").then(function(data) { |
| 11 | let lines = data.split("\n").filter((line) => line.startsWith(prefix)).map((line) => line.substring(prefix.length).split(" ")).map((line)=>line.slice(0,2).concat([line.slice(2).join(" ")])); |
| 12 | for(let i=0; i < lines.length; i++){ |
| 13 | lines[i][3] = i; |
| 14 | } |
| 15 | const len = lines.length; |
| 16 | lines = lines.slice(len-100,len); |
| 17 | let min=lines[0][1]; |
| 18 | var svg = d3.select("svg"); |
| 19 | svg.attr("width","1000%"); |
| 20 | svg.attr("height",800); |
| 21 | const hashCount = 6; |
| 22 | const color = d3.scaleOrdinal(d3.schemeCategory10); |
| 23 | svg.selectAll("text") |
| 24 | .data(lines) |
| 25 | .enter().append("text") |
| 26 | .attr("y", elem => { |
| 27 | if(elem[0] == -1){ |
| 28 | return 60; |
| 29 | } |
| 30 | return 100 + 20*((hashCount + 1)*elem[0] + (elem[3]%hashCount)); |
| 31 | }) |
| 32 | .attr("x", elem => Math.floor((elem[1]-min)/50000)) |
| 33 | .style("fill", elem => color(elem[2])) |
| 34 | .text((elem) => elem[2] ); |
| 35 | svg.selectAll("line").data([0,1,2]) |
| 36 | .enter().append("line") |
| 37 | .attr("x1", 0) |
| 38 | .attr("y1", elem => 80 + 20*(hashCount+1)*elem) |
| 39 | .attr("x2", "100%") |
| 40 | .attr("y2", elem => 80 + 20*(hashCount+1)*elem) |
| 41 | .attr("stroke", "black"); |
| 42 | }).catch(function(except){ |
| 43 | console.log(except); |
| 44 | }); |
| 45 | } |
| 46 | </script> |
| 47 | </head> |
| 48 | <body onLoad="loadData()"> |
| 49 | <svg id='render'/> |
| 50 | </body> |
| 51 | </html> |