Skip to content

Commit

Permalink
add landing page with upload, move actual visualization to app.html
Browse files Browse the repository at this point in the history
  • Loading branch information
LinqLover committed Oct 6, 2023
1 parent 609c478 commit 386ecab
Show file tree
Hide file tree
Showing 9 changed files with 323 additions and 180 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ You can customize much of it through optional URL parameters:

Examples:

- [https://linqlover.github.io/trace4d](https://linqlover.github.io/trace4d)
- [https://linqlover.github.io/trace4d/?trace=traces/regexMatch.json&countFPS](https://linqlover.github.io/trace4d/?trace=traces/regexMatch.json&countFPS)
- http://localhost:5173?trace=https://raw.githubusercontent.com/LinqLover/trace4d/main/assets/traces/displayScanner.json?measureStartTime
- [https://linqlover.github.io/trace4d/app.html](https://linqlover.github.io/trace4d/app.html)
- [https://linqlover.github.io/trace4d/app.html?trace=traces/regexMatch.json&countFPS](https://linqlover.github.io/trace4d/app.html?trace=traces/regexMatch.json&countFPS)
- http://localhost:5173/app.html?trace=https://raw.githubusercontent.com/LinqLover/trace4d/main/assets/traces/displayScanner.json?measureStartTime

If you have an [own trace file](#creating-a-program-trace), you first need to copy it to `assets/traces` (or to any public web server).
If you have an [own trace file](#creating-a-program-trace), you can select it on the [landing page](https://linqlover.github.io/trace4d/).

#### Navigation

Expand Down
2 changes: 1 addition & 1 deletion docs/paper/sections/05_use_case.tex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ \section{Use Case: Exploring Internals of a Regular Expression Engine}
In this example, our programmer visualizes the construction of the simple regular expression \hardcode{\textbackslash{}d|\textbackslash{}w+} to gain a closer understanding of the involved subsystems and their interactions.

To create the visualization, the programmer records and exports a trace of the program \code{\textquotesingle{}\textbackslash{}d|\textbackslash{}w+\textquotesingle{} asRegex} in Squeak and loads it into the \tfd{} web app%
\footnote{The interactive visualization of the described program trace is available at \ifanon{\url{https://user.github.io/repo/?trace=traces/regexParse.json} (blinded)}{\url{https://linqlover.github.io/trace4d/?trace=traces/regexParse.json}} and in the Wayback Machine of the Internet Archive.}%
\footnote{The interactive visualization of the described program trace is available at \ifanon{\url{https://user.github.io/repo/app.html?trace=traces/regexParse.json} (blinded)}{\url{https://linqlover.github.io/trace4d/app.html?trace=traces/regexParse.json}} and in the Wayback Machine of the Internet Archive.}%
.
As the visualization loads, she can see about 25 objects moving around in the object map and arranging themselves into a semi-structured graph within a few seconds~(\cref{fig:teaser}).
By navigating through the scene, she discovers several meaningful objects and clusters of objects:
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"license": "MIT",
"dependencies": {
"@fortawesome/fontawesome-free": "^6.4.2",
"bootstrap": "^5.3.2",
"collect.js": "^4.36.1",
"d3": "^7.8.5",
"d3-flame-graph": "^4.1.3",
Expand Down
177 changes: 177 additions & 0 deletions packages/frontend/src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Trace4D</title>
<link rel="shortcut icon" href="assets/t4d.ico" />
<style>
html, body {
height: 100%;
margin: 0;

font-family: sans-serif;
}

.overlay-container {
position: fixed;
}

.overlay {
overflow: hidden;
height: 100%;
}

.resizer[data-direction='vertical'] {
cursor: ns-resize;
height: 4px;
width: 100%;
position: absolute;
z-index: 2;
}

.has-touch-handler {
touch-action: none;
-webkit-tap-highlight-color: transparent;
}

#container {
width: 100%;
height: 100%;
}

#three {
width: 100%;
height: 100%;
}

#player-container {
bottom: 4vh;
left: 4vw;
right: 4vw;
height: 5%;
min-height: 4%;
}

#player {
background-color: #000000a0;

display: flex;
flex-direction: row;
align-items: center;

user-select: none;
}

.player-button {
height: 100%;
font-size: 2vh;
width: 4vh;
flex-shrink: 0;

color: white;
background: transparent;
border: none;

cursor: pointer;
}

#player-play {
display: block;
}

#player-pause {
display: none;
}

#player.playing #player-play {
display: none;
}

#player.playing #player-pause {
display: block;
}

#timeline {
height: 100%;
flex: auto;

background-color: #000000a0;

cursor: pointer;
}

#cursor {
position: relative;
left: 0;
top: 0;
z-index: 2;
width: .2em;
height: 100%;
background-color: #ffffff;
/* glow */
box-shadow: 0 0 6px #ffffff;

pointer-events: none; /* otherwise blocks clicks on flamegraph */
}

#flamegraph {
transform: translateY(-100%);
width: 100%;
height: 100%;
}

#flamegraph * {
user-select: none;
}

#flamegraph > svg {
width: 100%;
height: 100%;
}

#flamegraph .d3-flame-graph-label {
font-size: small;
transform: scaleX(0.8);
transform-origin: left;
}

.d3-flame-graph-tip.s {
background: #000000d0;
font-family: sans-serif;
padding: 5px;
color: white;
font-size: small;
}
</style>
<script defer type="module">
import '@fortawesome/fontawesome-free/css/all.css'
</script>
</head>

<body>
<script>
window.loadStartTime = performance.now()
</script>
<script type="module" src="resizers.js"></script>
<!-- Must be the LAST imported script or all others will be blocked in vite build -->
<script type="module" src="app.js"></script>
<div id="container">
<div id="three"></div>
<div id="player-container" class="overlay-container">
<div class="resizer" data-direction="vertical" data-edge="bottom"></div>
<div id="player" class="overlay">
<button id="player-play" class="player-button has-touch-handler">
<i class="fas fa-play"></i>
</button>
<button id="player-pause" class="player-button has-touch-handler">
<i class="fas fa-pause"></i>
</button>
<div id="timeline" class="has-touch-handler">
<div id="cursor" class="has-touch-handler"></div>
<div id="flamegraph"></div>
</div>
</div>
</div>
</div>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ async function init() {
Object.assign(traceMap.options, options)

traceMap.buildMap(document.querySelector('#container'))
await traceMap.loadTraceFromServerFile(traceUrl, style)
// check session storage for trace file
const sessionTrace = sessionStorage.getItem('trace')
if (sessionTrace) {
await traceMap.loadTraceFromString(sessionTrace, style)
} else {
await traceMap.loadTraceFromServerFile(traceUrl, style)
}
}

await init()
Loading

0 comments on commit 386ecab

Please sign in to comment.