我的测试设置(Mocha + Karma)开始在空闲/观看模式下持续占用60%到70%的cpu。我像
一样运行它NODE_ENV=test node_modules/.bin/karma start build/testing/karma.conf.js --no-single-run --auto-watch
我从5.x升级了节点 - > 6.2今天,但直到现在都没有高CPU(使用6小时后)。我按照here的说明运行了个人资料。这些是日志
[Summary]:
ticks total nonlib name
12260 14.8% 16.4% JavaScript
57135 69.0% 76.5% C++
2712 3.3% 3.6% GC
8112 9.8% Shared libraries
5318 6.4% Unaccounted
[C++]:
ticks total nonlib name
36120 43.6% 48.3% ___inc_remove_counter
1151 1.4% 1.5% node::InitFs(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, void*)
967 1.2% 1.3% _malloc_jumpstart
819 1.0% 1.1% v8::internal::IncrementalMarking::UpdateMarkingDequeAfterScavenge()
[Bottom up (heavy) profile]:
Note: percentage shows a share of a particular caller in the total
amount of its parent calls.
Callers occupying less than 2.0% are not shown.
ticks parent name
36120 43.6% ___inc_remove_counter
5318 6.4% UNKNOWN
4923 5.9% /usr/local/bin/node
579 11.8% v8::internal::Builtins::~Builtins()
166 28.7% LazyCompile: ~Socket._writeGeneric net.js:654:42
[C++ entry points]:
ticks cpp total name
4637 25.0% 5.6% v8::internal::Builtins::~Builtins()
2385 12.8% 2.9% v8::internal::Runtime_GetProperty(int, v8::internal::Object**, v8::internal::Isolate*)
1943 10.5% 2.3% v8::internal::Runtime_KeyedStoreIC_Miss(int, v8::internal::Object**, v8::internal::Isolate*)
966 5.2% 1.2% v8::internal::Runtime_KeyedLoadIC_Miss(int, v8::internal::Object**, v8::internal::Isolate*)
881 4.7% 1.1% v8::internal::Runtime_CompileOptimized_Concurrent(int, v8::internal::Object**, v8::internal::Isolate*)
699 3.8% 0.8% v8::internal::Runtime_HasOwnProperty(int, v8::internal::Object**, v8::internal::Isolate*)
626 3.4% 0.8% v8::internal::Runtime_WeakCollectionSet(int, v8::internal::Object**, v8::internal::Isolate*)
562 3.0% 0.7% v8::internal::Runtime_SetProperty(int, v8::internal::Object**, v8::internal::Isolate*)
488 2.6% 0.6% v8::internal::Runtime_StackGuard(int, v8::internal::Object**, v8::internal::Isolate*)
416 2.2% 0.5% v8::internal::Runtime_HasProperty(int, v8::internal::Object**, v8::internal::Isolate*)
409 2.2% 0.5% v8::internal::Runtime_LoadIC_Miss(int, v8::internal::Object**, v8::internal::Isolate*)
373 2.0% 0.5% v8::internal::Runtime_StringCharCodeAtRT(int, v8::internal::Object**, v8::internal::Isolate*)
313 1.7% 0.4% ___inc_remove_counter
___inc_remove_counter是什么?如何识别导致高CPU的原因?
感谢。
答案 0 :(得分:0)
虽然我清除了node_moules
并重新安装了所有依赖项,但我仍然遇到了问题。它通过清除缓存npm cache clean
然后重新安装所有deps来解决。