mirror of
https://github.com/enso-org/enso.git
synced 2024-12-22 23:51:31 +03:00
Drop render-profile; obsoleted by profiling-run-graph. (#3438)
This commit is contained in:
parent
a06f1ed3b9
commit
71adb7e0a4
21
Cargo.lock
generated
21
Cargo.lock
generated
@ -1509,26 +1509,6 @@ dependencies = [
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ensogl-example-render-profile"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"enso-frp",
|
||||
"enso-profiler",
|
||||
"enso-profiler-data",
|
||||
"enso-profiler-flame-graph",
|
||||
"enso-web",
|
||||
"ensogl-core",
|
||||
"ensogl-flame-graph",
|
||||
"ensogl-hardcoded-theme",
|
||||
"ensogl-text",
|
||||
"ensogl-text-msdf-sys",
|
||||
"futures 0.3.21",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ensogl-example-render-profile-flamegraph"
|
||||
version = "0.1.0"
|
||||
@ -1623,7 +1603,6 @@ dependencies = [
|
||||
"ensogl-example-list-view",
|
||||
"ensogl-example-mouse-events",
|
||||
"ensogl-example-profiling-run-graph",
|
||||
"ensogl-example-render-profile",
|
||||
"ensogl-example-render-profile-flamegraph",
|
||||
"ensogl-example-scroll-area",
|
||||
"ensogl-example-shape-system",
|
||||
|
@ -18,7 +18,6 @@ ensogl-example-glyph-system = { path = "glyph-system" }
|
||||
ensogl-example-list-view = { path = "list-view" }
|
||||
ensogl-example-mouse-events = { path = "mouse-events" }
|
||||
ensogl-example-profiling-run-graph = { path = "profiling-run-graph" }
|
||||
ensogl-example-render-profile = { path = "render-profile" }
|
||||
ensogl-example-render-profile-flamegraph = { path = "render-profile-flamegraph" }
|
||||
ensogl-example-scroll-area = { path = "scroll-area" }
|
||||
ensogl-example-shape-system = { path = "shape-system" }
|
||||
|
@ -1,35 +0,0 @@
|
||||
[package]
|
||||
name = "ensogl-example-render-profile"
|
||||
version = "0.1.0"
|
||||
authors = ["Enso Team <contact@enso.org>"]
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
enso-frp = { path = "../../../frp" }
|
||||
enso-profiler = { path = "../../../profiler" }
|
||||
enso-profiler-data = { path = "../../../profiler/data" }
|
||||
enso-profiler-flame-graph = { path = "../../../profiler/flame-graph" }
|
||||
enso-web = { path = "../../../web" }
|
||||
ensogl-core = { path = "../../core" }
|
||||
ensogl-flame-graph = { path = "../../component/flame-graph" }
|
||||
ensogl-hardcoded-theme = { path = "../../app/theme/hardcoded" }
|
||||
ensogl-text = { path = "../../component/text" }
|
||||
ensogl-text-msdf-sys = { path = "../../component/text/msdf-sys" }
|
||||
futures = "0.3"
|
||||
wasm-bindgen = { version = "0.2.58", features = [ "nightly" ] }
|
||||
wasm-bindgen-futures = "0.4"
|
||||
|
||||
[dependencies.web-sys]
|
||||
version = "0.3"
|
||||
features = [
|
||||
'Headers',
|
||||
'Request',
|
||||
'RequestInit',
|
||||
'RequestMode',
|
||||
'Response',
|
||||
'Window',
|
||||
]
|
@ -1,90 +0,0 @@
|
||||
//! Renders profiling data, obtained from a file, as a graph.
|
||||
|
||||
// === Standard Linter Configuration ===
|
||||
#![deny(non_ascii_idents)]
|
||||
#![warn(unsafe_code)]
|
||||
// === Non-Standard Linter Configuration ===
|
||||
#![warn(missing_copy_implementations)]
|
||||
#![warn(missing_debug_implementations)]
|
||||
#![warn(missing_docs)]
|
||||
#![warn(trivial_casts)]
|
||||
#![warn(trivial_numeric_casts)]
|
||||
#![warn(unused_import_braces)]
|
||||
#![warn(unused_qualifications)]
|
||||
|
||||
use ensogl_core::prelude::*;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
use enso_profiler_data as profiler_data;
|
||||
use enso_profiler_flame_graph as profiler_flame_graph;
|
||||
use ensogl_core::application;
|
||||
use ensogl_core::data::color;
|
||||
use ensogl_core::display;
|
||||
use ensogl_core::display::navigation::navigator;
|
||||
use ensogl_core::display::style::theme;
|
||||
use ensogl_flame_graph as flame_graph;
|
||||
|
||||
|
||||
|
||||
// ===================
|
||||
// === Entry Point ===
|
||||
// ===================
|
||||
|
||||
/// Render a graph of a profile file.
|
||||
#[entry_point]
|
||||
#[allow(dead_code)]
|
||||
pub async fn main() {
|
||||
use ensogl_core::display::object::ObjectOps;
|
||||
let app = application::Application::new("root");
|
||||
let world = &app.display;
|
||||
let scene = &world.default_scene;
|
||||
let navigator = navigator::Navigator::new(scene, &scene.camera());
|
||||
init_theme(scene);
|
||||
let data = get_data().await;
|
||||
let profile: profiler_data::Profile<profiler_data::OpaqueMetadata> = data.parse().unwrap();
|
||||
let graph = profiler_flame_graph::Graph::new_hybrid_graph(&profile);
|
||||
let flame_graph = flame_graph::FlameGraph::from_data(graph, &app);
|
||||
scene.add_child(&flame_graph);
|
||||
scene.layers.main.add_exclusive(&flame_graph);
|
||||
world.keep_alive_forever();
|
||||
world
|
||||
.on
|
||||
.before_frame
|
||||
.add(move |_time| {
|
||||
let _keep_alive = &navigator;
|
||||
let _keep_alive = &flame_graph;
|
||||
})
|
||||
.forget();
|
||||
}
|
||||
|
||||
/// Read profile data from a file. The file must be located at `/profile.json` in the root of the
|
||||
/// directory that will be made available by the webserver, i.e. `enso/dist/content`.
|
||||
async fn get_data() -> String {
|
||||
use wasm_bindgen::JsCast;
|
||||
|
||||
let url = "/profile.json";
|
||||
let mut opts = web_sys::RequestInit::new();
|
||||
opts.method("GET");
|
||||
opts.mode(web_sys::RequestMode::Cors);
|
||||
let request = web_sys::Request::new_with_str_and_init(url, &opts).unwrap();
|
||||
request.headers().set("Accept", "application/json").unwrap();
|
||||
let window = web_sys::window().unwrap();
|
||||
let response = window.fetch_with_request(&request);
|
||||
let response = wasm_bindgen_futures::JsFuture::from(response).await.unwrap();
|
||||
assert!(response.is_instance_of::<web_sys::Response>());
|
||||
let response: web_sys::Response = response.dyn_into().unwrap();
|
||||
let data = response.text().unwrap();
|
||||
let data = wasm_bindgen_futures::JsFuture::from(data).await.unwrap();
|
||||
data.as_string().unwrap()
|
||||
}
|
||||
|
||||
fn init_theme(scene: &display::Scene) {
|
||||
let theme_manager = theme::Manager::from(&scene.style_sheet);
|
||||
let theme = theme::Theme::new();
|
||||
const COLOR_PATH: &str = "flame_graph_color";
|
||||
theme.set(COLOR_PATH, color::Rgb::new(1.0, 180.0 / 255.0, 0.0));
|
||||
theme_manager.register("theme", theme);
|
||||
theme_manager.set_enabled(&["theme".to_string()]);
|
||||
let style_watch = ensogl_core::display::shape::StyleWatch::new(&scene.style_sheet);
|
||||
style_watch.get(COLOR_PATH);
|
||||
}
|
@ -37,7 +37,6 @@ pub use ensogl_example_glyph_system as glyph_system;
|
||||
pub use ensogl_example_list_view as list_view;
|
||||
pub use ensogl_example_mouse_events as mouse_events;
|
||||
pub use ensogl_example_profiling_run_graph as profiling_run_graph;
|
||||
pub use ensogl_example_render_profile as render_profile;
|
||||
pub use ensogl_example_render_profile_flamegraph as render_profile_flamegraph;
|
||||
pub use ensogl_example_scroll_area as scroll_area;
|
||||
pub use ensogl_example_shape_system as shape_system;
|
||||
|
Loading…
Reference in New Issue
Block a user