Skip to content

Commit 9a7efb5

Browse files
committed
Add documentation with images for the HTML template
This closes #8
1 parent 58c8771 commit 9a7efb5

File tree

5 files changed

+137
-21
lines changed

5 files changed

+137
-21
lines changed

html/FEATURES.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Features and functionalities
2+
3+
<!-- TOC -->
4+
* [Features and functionalities](#features-and-functionalities)
5+
* [Loading in Data](#loading-in-data)
6+
* [Selecting Loaded Data](#selecting-loaded-data)
7+
* [Information about the data](#information-about-the-data)
8+
* [Working with the data](#working-with-the-data)
9+
* [Changing the layout](#changing-the-layout)
10+
* [Getting more information](#getting-more-information)
11+
* [Indexes](#indexes)
12+
* [Individual read and write accesses vs total accesses](#individual-read-and-write-accesses-vs-total-accesses)
13+
* [Doing a deep dive into individual indexes](#doing-a-deep-dive-into-individual-indexes)
14+
* [Theme](#theme)
15+
<!-- TOC -->
16+
17+
## Loading in Data
18+
19+
![Loading Data](https://user-images.githubusercontent.com/18115780/218279202-8f11fb70-ab89-4309-8600-d018c156e7b4.png)
20+
21+
Either when opening the HTML file for the first time, or by selecting None on the left sidebar the user is able to load in a JSON file.
22+
It can either be drag and dropped into the gray area in the center, or alternatively you can click this area to then open a file selection dialog.
23+
24+
As described in the main [README](README.md) you can alternatively statically already include a single JSON file within a HTML file. But this will be slower due to parsing it in a different way.
25+
26+
### Selecting Loaded Data
27+
28+
The data contained within the loaded JSON files can then be selected in the list on the left.
29+
30+
### Information about the data
31+
32+
Currently selected files do have some metadata displayed. This will be visible in the bottom of the sidebar.
33+
By default, they will be collapsed, but the user can extend them to see the individual data.
34+
35+
By hovering the address range in the *Active Memory Information* section you can also see how many elements this specific array contained, and what the size of a single element was.
36+
37+
This is shown in the screenshot below.
38+
39+
![image](https://user-images.githubusercontent.com/18115780/218279550-3d6f6313-17db-4147-a559-d6e9f28b441c.png)
40+
41+
## Working with the data
42+
43+
### Changing the layout
44+
45+
A key feature is changing the layout. With defaults settings all the data is just fit on screen. But often data has meaning, especially in 2D data, or for example the reduction which is used as an example here.
46+
47+
For this "width" of a row can be set on the bottom left. This would look like the following in the reduction example:
48+
49+
![image](https://user-images.githubusercontent.com/18115780/218279692-fea204c7-6071-4686-9ef7-1b9f0d33f30a.png)
50+
51+
After setting it to a certain width, the user can pan left and right. (Additionally to up and down)
52+
53+
Although it is rarely needed, there is a dedicated button to change from a grid layout (default) to one long list.
54+
55+
![image](https://user-images.githubusercontent.com/18115780/218279757-fdf40457-7d5c-469c-9d52-598a2731278e.png)
56+
57+
This is (besides an implementation detail) the same as setting the width to 1 on the bottom left.
58+
59+
But this a good example to explain the meaning of the buttons. **__The icon of a button (besides the light mode toggle) always represents the state change which would happen.__** So for example if you are in grid mode, the icon will be a linearized icon, if you are in linear mode, the icon will be a grid.
60+
61+
### Getting more information
62+
63+
#### Indexes
64+
65+
By default, no index information is displayed, to have a "cleaner" look. If you want to know the index of an individual element, you can hover it for a bit, and then it's index will be displayed. But should this not be sufficient, you can toggle that indices are always displayed.
66+
67+
See the image below as example:
68+
69+
![image](https://user-images.githubusercontent.com/18115780/218279988-c6280236-ae8c-47a8-a7a3-c78f430aa945.png)
70+
71+
#### Individual read and write accesses vs total accesses
72+
73+
With unchanged settings, read and write accesses will be shown individually. Then each row contains in blue the read accesses on top, and in orange the write accesses below.
74+
75+
The behavior can be toggled with the button shown in the image below.
76+
77+
![imgage](https://user-images.githubusercontent.com/18115780/218280884-6a6965f8-5ccb-41f7-a0c5-0196f7688bbf.png)
78+
79+
As you might already have spotted, total accesses additionally has blue color palette button in the header bar.
80+
This is because for total accesses you might care especially about certain patterns, or even slight differences.
81+
To make this easier, it is possible to adjust the color mapping function which is used to color the different values.
82+
83+
For that click the colored icon in the top bar and you will be greeted with the following menu:
84+
85+
![image](https://user-images.githubusercontent.com/18115780/218280217-a0e64719-c89a-4516-9dba-2e1bb7da03ec.png)
86+
87+
In this menu you can enable the use of a cube helix color mapping function, and then additionally change all the parameters in the interface, while seeing a preview of how the function would look like.
88+
89+
On the bottom you will also find a few presets, which also allow you to quickly reset the values to a default scheme.
90+
91+
To make comparisons between different data structures easier, it is also possible to set a custom reference maximum value. By default, the maximum value of the displayed data is used, but you could also set this to a higher or lower value, to see if one algorithm (performing the same tasks) does better or worse considering memory accesses.
92+
93+
Using 100 memory accesses as reference, instead of the 11 which the reduced example contains would look like this:
94+
95+
![image](https://user-images.githubusercontent.com/18115780/218280355-0d492674-fe1c-46ac-8512-a3ee389cd69d.png)
96+
97+
#### Doing a deep dive into individual indexes
98+
99+
To get more specific information, instead of an overview, it is also possible to select a single index (*You have to click the cell with the number representing the accesses, not the index itself if you are displaying the indexes*) by clicking on it.
100+
101+
This will then open up a drawer which shows you the individual accesses with their respective thread ids and block ids in chronological order.
102+
103+
By default, the drawer will only show the data of what you clicked on (read only, write only, total), but you can also toggle this mode within the drawer by clicking the header.
104+
105+
The drawer looks like the following:
106+
107+
![image](https://user-images.githubusercontent.com/18115780/218280516-c8bc3f48-0016-4503-979d-3754d16f762b.png)
108+
109+
## Theme
110+
111+
For people preferring light mode (for example for better readability), this is actually included in the app.
112+
113+
In the top right next to the *About* button, you have two toggles. The Switch type button toggles the theme of the entire app, the button with the lamp icon toggles the background color of the cells.
114+
115+
Toggling both looks like the following:
116+
117+
![image](https://user-images.githubusercontent.com/18115780/218280714-1deddf62-9aed-4721-8793-97c66795ad9b.png)

html/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
This folders contains the project which generates the HTML template.
44

5+
The overall application with a reduction dataset loaded in looks like this:
6+
7+
![Application Preview](https://user-images.githubusercontent.com/18115780/218279005-7b91f1ed-f029-4e75-90d8-c6d1c5dcc3fc.png)
8+
9+
510
It is build on the following technologies (those are the most important ones):
611

712
* TypeScript
@@ -31,6 +36,8 @@ But first how to use and install the project.
3136

3237
To use the project, you don't need to do anything else. There should be a pre-built HTML file ready for you to use.
3338

39+
Besides the text below, there is an [additional Documentation file here](FEATURES.md), which showcases the individual features with images.
40+
3441
To then make use of that file the suggested way is to generate static `.json` data files with the C++ header using any of the available methods for JSON. And then opening the HTML file and dragging and dropping the `.json` into the dedicated area. This method has the fastest loading speed, as then the browser can directly read in the file and parse it with a JSON parser instead of using a more generic (and slower) parser.
3542

3643
After loading the data either way, you can now select on the left side any loaded in data structure for viewing. You can select them and then get a visualization of them in the center of the screen.
@@ -99,6 +106,8 @@ This will currently create a `build` folder with an `index.html` file in it.
99106

100107
All packages used in `package.json` are listed here with a short explanation (in alphabetical order).
101108

109+
All packages are in the `devDependencies` section, as we are bundling everything into a single HTML file, so we do not have runtime dependencies (as those will be bundled into that file).
110+
102111
* `@iconify/icons-ic`
103112
* Add the `icons-ic` icon set for offline use. A list of all available icons can be found [here](https://icon-sets.iconify.design/ic/).
104113
* `@iconify/svelte`
@@ -170,7 +179,7 @@ The current code is quite simple, and just's loads in the Svelte component in th
170179

171180
The entirety of the remaining application is then contained within the Svelte components.
172181

173-
`App.svelte` loads in the `src/components/Layout.svelte` component for overall page structure (header, ...). Then all the key data is loaded. For that a JSON object is parsed which is supposed to contain all the memory information. During development example data from `data` is loaded in. At export, it will be just a placeholder string, which needs to be filled in by the C++ application.
182+
`App.svelte` loads in the `src/components/Layout.svelte` component for overall page structure (header, ...). Then all the key data is loaded. For that a JSON object is parsed which is supposed to contain all the memory information. During development example data from `data` is loaded in. At export, it will be just a placeholder string, which needs to be filled in by the C++ application. Alternatively there is a drag n' drop area where users can drag in their files.
174183

175184
Global CSS classes are loaded in `src/components/Layout.svelte`, to define own global CSS `src/app.pcss` can be used. But it is advised to keep CSS contained within the Svelte components.
176185

html/src/App.svelte

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
<script lang="ts">
2-
import { fade, slide, scale } from 'svelte/transition';
3-
2+
import { fade, slide } from 'svelte/transition';
3+
import { FileDropzone } from '@skeletonlabs/skeleton';
4+
import { dummyData } from './lib/loadDummyData';
5+
import InspectDrawer from './components/InspectDrawer.svelte';
6+
import VisualizeMemoryRegion from './components/VisualizeMemoryRegion.svelte';
7+
import { currentMemoryRegion, pageState } from './lib/stores';
48
import Layout from './components/Layout.svelte';
9+
import { AccessInstance, MemoryRegionManager, type OutputJSON } from './lib/types';
510
611
// Have map storing for each memory address the corresponding memory accesses
712
// To have a range, we also need to store our minimum and maximum address
@@ -12,15 +17,6 @@
1217
return this.toString();
1318
};
1419
15-
import { AccessInstance, type GenericInformation, MemoryRegionManager, type OutputJSON } from './lib/types';
16-
17-
import { Drawer, drawerStore, FileDropzone } from '@skeletonlabs/skeleton';
18-
import { dummyData } from './lib/loadDummyData';
19-
import InspectDrawer from './components/InspectDrawer.svelte';
20-
import VisualizeMemoryRegion from './components/VisualizeMemoryRegion.svelte';
21-
import { pageState } from './lib/stores';
22-
import { currentMemoryRegion } from './lib/stores';
23-
2420
// Function to load a valid JSON file into the application as memory structure
2521
const loadJSON = (json: OutputJSON) => {
2622
const info = json.GlobalSettings;

html/src/components/MemoryRegionBlock.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import { cubeHelixLookup, drawerState } from '../lib/stores';
33
import { MemoryRegionManager } from '../lib/types';
4-
import { drawerStore, tooltip } from '@skeletonlabs/skeleton';
4+
import { drawerStore } from '@skeletonlabs/skeleton';
55
import { pageState } from '../lib/stores';
66
77
export let MemoryRegion: MemoryRegionManager;

html/src/components/ModalColorSelection.svelte

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
<script lang="ts">
2-
import { Modal, modalStore, RangeSlider, SlideToggle } from '@skeletonlabs/skeleton';
3-
import {
4-
pageState,
5-
cubeHelixParameters,
6-
cubeHelixLookup,
7-
cubeHelixMapFunction,
8-
currentMemoryRegion
9-
} from '../lib/stores';
2+
import { Modal, RangeSlider, SlideToggle } from '@skeletonlabs/skeleton';
3+
import { pageState, cubeHelixParameters, currentMemoryRegion } from '../lib/stores';
104
import { derived, writable } from 'svelte/store';
115
import { cubehelix } from 'cubehelix';
126

0 commit comments

Comments
 (0)