當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript v8-profiler.stopProfiling函數代碼示例

本文整理匯總了TypeScript中v8-profiler.stopProfiling函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript stopProfiling函數的具體用法?TypeScript stopProfiling怎麽用?TypeScript stopProfiling使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了stopProfiling函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: exitHandler

  function exitHandler(options: any, _err: Error) {
    if (options.cleanup) {
      const cpuProfile = profiler.stopProfiling();
      fs.writeFileSync(path.resolve(process.cwd(), process.env.NG_CLI_PROFILING) + '.cpuprofile',
        JSON.stringify(cpuProfile));
    }

    if (options.exit) {
      process.exit();
    }
  }
開發者ID:headinclouds,項目名稱:angular-cli,代碼行數:11,代碼來源:init.ts

示例2:

  const exitHandler = (options: { cleanup?: boolean, exit?: boolean }) => {
    if (options.cleanup) {
      const cpuProfile = profiler.stopProfiling();
      fs.writeFileSync(
        path.resolve(process.cwd(), process.env.NG_CLI_PROFILING || '') + '.cpuprofile',
        JSON.stringify(cpuProfile),
      );
    }

    if (options.exit) {
      process.exit();
    }
  };
開發者ID:baconwaffles,項目名稱:angular-cli,代碼行數:13,代碼來源:init.ts

示例3: setTimeout

 setTimeout(function () {
     var profile = profiler.stopProfiling('');
     profiler.deleteAllProfiles();
 }, 1000);
開發者ID:Agamnentzar,項目名稱:DefinitelyTyped,代碼行數:4,代碼來源:v8-profiler-tests.ts

示例4: function

    console.log(snapshot1.compare(snapshot2));

    // Export snapshot to file file
    snapshot1.export(function (error, result) {
        fs.writeFileSync('snapshot1.json', result);
        snapshot1.delete();
    });

    // Export snapshot to file stream
    snapshot2.export()
        .pipe(fs.createWriteStream('snapshot2.json'))
        .on('finish', snapshot2.delete);
}
{
    profiler.startProfiling('1', true);
    var profile1 = profiler.stopProfiling();
    profiler.startProfiling('2', true);
    var profile2 = profiler.stopProfiling();

    console.log(snapshot1.getHeader(), snapshot2.getHeader());

    profile1.export(function (error, result) {
        fs.writeFileSync('profile1.json', result);
        profile1.delete();
    });

    profile2.export()
        .pipe(fs.createWriteStream('profile2.json'))
        .on('finish', function () {
            profile2.delete();
        });
開發者ID:Agamnentzar,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:v8-profiler-tests.ts

示例5: findAll

import { createWriteStream } from 'fs'
import * as profiler from 'v8-profiler'
import { findAll } from '..'
import { ALL_CONSTRAINTS } from './pentomino/field'

profiler.startProfiling('1', true)

findAll(ALL_CONSTRAINTS)

const profile = profiler.stopProfiling()

profile.export().pipe(createWriteStream('profile.cpuprofile'))
開發者ID:TimBeyer,項目名稱:node-dlx,代碼行數:12,代碼來源:profile.ts


注:本文中的v8-profiler.stopProfiling函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。