Skip to content

Commit

Permalink
new scheduler: intervals instead of each hour
Browse files Browse the repository at this point in the history
add dhat and profiling instructions
  • Loading branch information
tijlleenders committed Jan 19, 2025
1 parent 8381f0c commit 4170421
Show file tree
Hide file tree
Showing 36 changed files with 2,368 additions and 2,136 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ tests/rust_tests.rs
_logs/
js-api/
tests/jsons/stable/tijl-goals
.idea
.idea
/dhat-heap.json
4 changes: 2 additions & 2 deletions build_templates/tests_mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ mod TEST_MODULE_NAME {
// experimental tests
//TEST_FUNCTIONS_EXPERIMENTAL

use std::path::Path;

use scheduler::technical::input_output;
use scheduler::technical::input_output::Input;
use std::path::Path;

fn test(folder: &str) {
let (actual_output, desired_output) = generate_outputs(folder);
Expand All @@ -34,7 +35,6 @@ mod TEST_MODULE_NAME {
input.end_date,
&input.goals,
&input.tasks_completed_today,
input.global_not_on,
);

let actual_output = serde_json::to_string_pretty(&output).unwrap();
Expand Down
11 changes: 11 additions & 0 deletions documentation/technical/Profiling.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
## Profiling setup

### Samply

Samply is a general-purpose sampler that uses the firefox profiler.
https://github.com/mstange/samply/

### DHAT

DHAT is a heap allocation profiler.
You can launch the profiler using `cargo t --release --features dhat-heap --test rust_tests e2e::tijl_goals`.
Launch all tests in single-threaded mode - since there can't be two profilers running at the same
time: `cargo t --release --features dhat-heap --test rust_tests -- --test-threads=1
`.
View the `dhat-heap.json` with an on/offline viewer, for
example https://nnethercote.github.io/dh_view/dh_view.html
36 changes: 36 additions & 0 deletions pkg/scheduler.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,39 @@ interface Input {
}



export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly schedule: (a: number) => Array;
readonly __wbindgen_malloc: (a: number, b: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
readonly __wbindgen_export_2: WebAssembly.Table;
readonly __externref_table_dealloc: (a: number) => void;
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
readonly __wbindgen_exn_store: (a: number) => void;
readonly __externref_table_alloc: () => number;
readonly __wbindgen_start: () => void;
}

export type SyncInitInput = BufferSource | WebAssembly.Module;
/**
* Instantiates the given `module`, which can either be bytes or
* a precompiled `WebAssembly.Module`.
*
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
*
* @returns {InitOutput}
*/
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;

/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
*
* @returns {Promise<InitOutput>}
*/
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
Loading

0 comments on commit 4170421

Please sign in to comment.