const contentTracing = require('electron').contentTracing;
const options = {
categoryFilter: '*',
traceOptions: 'record-until-full,enable-sampling'
}
contentTracing.startRecording(options, function() {
console.log('Tracing started');
setTimeout(function() {
contentTracing.stopRecording('', function(path) {
console.log('Tracing data recorded to ' + path);
});
}, 5000);
});
方法
contentTracing.getCategories(callback)
contentTracing.startRecording(options, callback)
options
ObjectcategoryFilter
StringtraceOptions
String
callback
Function
例子:
test_MyTest*
,test_MyTest*,test_OtherStuff
,"-excluded_category1,-excluded_category2
record-until-full
record-continuously
trace-to-console
enable-sampling
enable-systrace
contentTracing.stopRecording(resultFilePath, callback)
resultFilePath
Stringcallback
Function
contentTracing.startMonitoring(options, callback)
options
ObjectcategoryFilter
StringtraceOptions
String
callback
Function
contentTracing.stopMonitoring(callback)
contentTracing.captureMonitoringSnapshot(resultFilePath, callback)
resultFilePath
Stringcallback
Function
contentTracing.getTraceBufferUsage(callback)
contentTracing.setWatchEvent(categoryName, eventName, callback)
categoryName
StringeventName
Stringcallback
Function
请发表评论