tensorflow / tensorflow/tensorboard
Profiler Trace Viewer access through ifame tag on custom plugin
@wchargin is already working on this.
Since Mar 3, 2021.
- Dominant language
- TypeScript
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 1
Description
TensorFlow 2.2.0
TensorBoard 2.2.2
I'am currently working on a project that is developing a plugin for tensorboard that tries to get power consumption data through time and plot it along with the trace_viewer from the Profiler plugin.
This plugin has the goal of showing which process on trace viewer has the most power consumption through time.
The plugin gets the profiler visualization from an iframe and tries to modify its HTML code in order to fit our power consumption graph into the trace_viewer.
In the current stage, our approach basically does this:
// Create iframe:
var iframe = document.createElement("iframe");
iframe.id = "myframe";
iframe.src = "/#profile";
document.body.appendChild(iframe);
// Create a header element inside the trace_view
const h1var = document.getElementById("myframe").contentWindow.document.getElementsByTagName("tf-tensorboard")[0].root.getElementById("dashboard").contentWindow.document.getElementsByTagName("iframe")[0].contentWindow.document.createElement('h1');
// Add a TextNode to that header
h1var.appendChild(document.getElementById("myframe").contentWindow.document.getElementsByTagName("tf-tensorboard")[0].root.getElementById("dashboard").contentWindow.document.getElementsByTagName("iframe")[0].contentWindow.document.createTextNode("First print"));
// Add the header to the trace_viewer
document.getElementById("myframe").contentWindow.document.getElementsByTagName("tf-tensorboard")[0].root.getElementById("dashboard").contentWindow.document.getElementsByTagName("iframe")[0].contentWindow.document.getElementsByTagName("div")[22].appendChild(h1var);
But we are facing some troubles in modifying the trace-viewer iframe.
For instance, because there are multiples iframes in the profiler, it takes time for each one to load, and that makes the access made in the code above difficult to do inside the plugin (it only works in the Browser Console).
That being said, I would like to ask some questions:
1- Do you think it's viable to plot a javascript made graph with canvas inside the iframe of trace-viewer?
2- If yes, is there a better way of ploting that graph inside the iframe than our current approach?
Thanks for your support.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.