Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonwilliams committed Apr 13, 2020
1 parent 10ba891 commit 6da8e08
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@ node_modules
yarn-error.log
.vscode/settings.json

# Profiling
*.string_data
*.string_index
*.events
chrome_profiler.json

# tests/js/test.js is used for testing changes locally
tests/js/test.js
3 changes: 1 addition & 2 deletions boa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ pub fn forward(engine: &mut Interpreter, src: &str) -> String {
pub fn forward_val(engine: &mut Interpreter, src: &str) -> ResultValue {
// Setup executor
let profiler = MyProfiler::new();
profiler.start_event("Parser");
let res = parser_expr(src).unwrap();
let _timer = profiler.start_event("Main");

match parser_expr(src) {
Ok(expr) => engine.run(&expr),
Expand Down
4 changes: 2 additions & 2 deletions boa/src/profiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ pub struct MyProfiler {
impl MyProfiler {
pub fn start_event(&self, label: &str) -> TimingGuard<'_, SerializationSink> {
let kind = self.profiler.alloc_string("Generic");
let lab = EventId::from_label(self.profiler.alloc_string(label));
let id = EventId::from_label(self.profiler.alloc_string(label));
let thread_id = std::thread::current().id().as_u64() as u32;
self.profiler
.start_recording_interval_event(kind, lab, thread_id)
.start_recording_interval_event(kind, id, thread_id)
}

pub fn new() -> MyProfiler {
Expand Down

0 comments on commit 6da8e08

Please sign in to comment.