Skip to content
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

setTimeout is attributed to the file in which it is called. #346

Open
nolanmar511 opened this issue Nov 29, 2018 · 3 comments
Open

setTimeout is attributed to the file in which it is called. #346

nolanmar511 opened this issue Nov 29, 2018 · 3 comments
Labels
api: cloudprofiler Issues related to the googleapis/cloud-profiler-nodejs API. external This issue is blocked on a bug with the actual product. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@nolanmar511
Copy link
Contributor

image

This is the script used (it's what we use in our prober), but I saw the same thing happening when I was experimenting with getting accurate line numbers:

var profiler = require('@google-cloud/profiler').start({
  serviceContext: {
    service: 'service',
    version: 'version',
  },
});
const startTime = Date.now();
const testArr = [];

function nodeJSLoop(durationSeconds) {
  for (let i = 0; i < testArr.length; i++) {
    for (let j = 0; j < testArr[i].length; j++) {
      testArr[i][j] = Math.sqrt(j * testArr[i][j]);
    }
  }
  if (Date.now() - startTime < 1000 * durationSeconds) {
    setTimeout(() => nodeJSLoop(durationSeconds), 5);
  }
}

function nodeJSBench(durationSeconds) {
  // Allocate 16 MiB in 64 KiB chunks.
  for (let i = 0; i < 16*16; i++) {
    testArr[i] = new Array(64 * 1024);
  }
	nodeJSLoop(durationSeconds)
}

@JustinBeckwith JustinBeckwith added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Nov 29, 2018
@nolanmar511
Copy link
Contributor Author

@psmarshall -- is this be expected?

@psmarshall
Copy link

Is the expected result that it shows up in node/lib/timers.js where this is implemented?

@nolanmar511
Copy link
Contributor Author

Yes, I think I would expect it's file to be timer.js (it's parent is indicated as being in "timer.js").
Should have clarified, so thanks!

@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Jun 4, 2019
@nolanmar511 nolanmar511 added external This issue is blocked on a bug with the actual product. and removed 🚨 This issue needs some love. labels Oct 14, 2019
@google-cloud-label-sync google-cloud-label-sync bot added the api: cloudprofiler Issues related to the googleapis/cloud-profiler-nodejs API. label Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: cloudprofiler Issues related to the googleapis/cloud-profiler-nodejs API. external This issue is blocked on a bug with the actual product. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

4 participants