Spaces:
Runtime error
Runtime error
neon_arch
commited on
Commit
•
4afc0d1
1
Parent(s):
7a8bf02
⚙️ refactor: add dhat profiler configuration with feat flag (#180)(#178)
Browse files- src/bin/websurfx.rs +9 -0
src/bin/websurfx.rs
CHANGED
@@ -6,6 +6,11 @@
|
|
6 |
use std::net::TcpListener;
|
7 |
use websurfx::{config::parser::Config, run};
|
8 |
|
|
|
|
|
|
|
|
|
|
|
9 |
/// The function that launches the main server and registers all the routes of the website.
|
10 |
///
|
11 |
/// # Error
|
@@ -14,6 +19,10 @@ use websurfx::{config::parser::Config, run};
|
|
14 |
/// available for being used for other applications.
|
15 |
#[actix_web::main]
|
16 |
async fn main() -> std::io::Result<()> {
|
|
|
|
|
|
|
|
|
17 |
// Initialize the parsed config file.
|
18 |
let config = Config::parse(false).unwrap();
|
19 |
|
|
|
6 |
use std::net::TcpListener;
|
7 |
use websurfx::{config::parser::Config, run};
|
8 |
|
9 |
+
/// A dhat heap memory profiler
|
10 |
+
#[cfg(feature = "dhat-heap")]
|
11 |
+
#[global_allocator]
|
12 |
+
static ALLOC: dhat::Alloc = dhat::Alloc;
|
13 |
+
|
14 |
/// The function that launches the main server and registers all the routes of the website.
|
15 |
///
|
16 |
/// # Error
|
|
|
19 |
/// available for being used for other applications.
|
20 |
#[actix_web::main]
|
21 |
async fn main() -> std::io::Result<()> {
|
22 |
+
// A dhat heap profiler initialization.
|
23 |
+
#[cfg(feature = "dhat-heap")]
|
24 |
+
let _profiler = dhat::Profiler::new_heap();
|
25 |
+
|
26 |
// Initialize the parsed config file.
|
27 |
let config = Config::parse(false).unwrap();
|
28 |
|