Skip to content

auto start the CPU profiler #491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 9, 2016

Conversation

jamestalmage
Copy link
Contributor

This will automatically start the DevTools profiler when running profile.js

require('./lib/test-worker');
console.profile('AVA test-worker process');

setTimeout(function () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? And setImmediate instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The profiler seemed to startup async.

@jamestalmage
Copy link
Contributor Author

setImmediate works.

iron-node works just fine with a synchronous call. With devtool doesn't print the "profile started" line unless I use setImmediate.

// @mattdesl

@mattdesl
Copy link

Not sure why there would be a difference. You could try --no-node-timers to see if that is the reason setImmediate was needed.

@mattdesl
Copy link

mattdesl commented Feb 1, 2016

I've cloned ava and I'm trying to run some tests with devtool.

devtool node_modules/ava/profile.js <test-file>

Are there specific files to use for <test-file> that I should be profiling? Or are you just npm linking ava and testing it on random projects?

@jamestalmage
Copy link
Contributor Author

You can link it, or use a fixture

devtool profile.js test/fixtures/es2015.js

@mattdesl
Copy link

mattdesl commented Feb 1, 2016

Pulled from master. Testing with [email protected], node@5 and [email protected], adding the console.profile/profileEnd works fine without setImmediate for the above fixture. Which test is failing?

@jamestalmage
Copy link
Contributor Author

It doesn't log the "profiling started" line - I think that may be the only issue. But it makes me paranoid that I might be missing some profiling data

@sindresorhus
Copy link
Member

@jamestalmage Can you open an issue on devtool about this? It's weird that setImmediate is required.

sindresorhus added a commit that referenced this pull request Feb 9, 2016
@sindresorhus sindresorhus merged commit f6fb592 into avajs:master Feb 9, 2016
@jamestalmage jamestalmage deleted the auto-start-profiler branch April 6, 2016 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants