context.end(operations[, options])


  • operations <number> 已完成操作的数量。必须是一个正的安全整数。
  • options <Object>
    • detail <any> 额外的可结构化克隆示例数据。使用 CLI 进程隔离时,它还必须支持高级子进程序列化。
  • 返回:<Object> 样本的 operations、duration_ns、计算得到的 rate,以及可选的克隆 detail。

结束测量区域。在验证 operations 之前会捕获结束时间戳。在 start() 之前调用 end()、调用多次,或者记录零时长样本都是错误的。如果提供了 detail,它会在捕获结束时间戳后被克隆,所以克隆时间是在测量区域之外的。

🌐 Ends the measured region. The end timestamp is captured before operations is validated. Calling end() before start(), calling it more than once, or recording a zero-duration sample is an error. When provided, detail is cloned after the end timestamp is captured, so cloning time is outside the measured region.