CakePHP3에서 처리 실행 시간을 측정하는 간단한 방법
CakePHP3에서 처리 실행 시간을 측정하는 간단한 방법
어디에 시간이 걸리고 있는지, 각 처리의 실행 시간을 계측하고 싶을 때, 있지요?
그러한 때, 여러가지 계측 방법이 있다고 생각합니다만, CakePHP3로, 손쉽게 계측하고 싶을 때는 \DebugKit\DebugTimer
를 사용하면 편합니다.
측정 코드 설치
\DebugKit\DebugTimer::start()
와 \DebugKit\DebugTimer::stop()
를 꽂습니다. 첫 번째 인수가 키이므로 맞추십시오.
<?php
-snip-
public function edit($id = null)
{
\DebugKit\DebugTimer::start('post_get', 'データ取得'); // 計測スタート
$post = $this->Posts->get($id, [
'contain' => ['Tags']
]);
\DebugKit\DebugTimer::stop('post_get'); // 計測終了
if ($this->request->is(['patch', 'post', 'put'])) {
$post = $this->Posts->patchEntity($post, $this->request->data);
if ($this->Posts->save($post)) {
$this->Flash->success(__('The post has been saved.'));
- snip -
런타임 확인
DebugKit의 Timer 패널을 확인해보십시오.
![](https://s1.md5.ltd/image/2b457bd82234a5fe1a53decd831cda85.png)
「데이터 취득」이라고 하는 행이 증가하고 있군요.
중첩 측정도 가능합니다.
락-.
Reference
이 문제에 관하여(CakePHP3에서 처리 실행 시간을 측정하는 간단한 방법), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/k1LoW/items/7ac37ea64922edf284ef
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
<?php
-snip-
public function edit($id = null)
{
\DebugKit\DebugTimer::start('post_get', 'データ取得'); // 計測スタート
$post = $this->Posts->get($id, [
'contain' => ['Tags']
]);
\DebugKit\DebugTimer::stop('post_get'); // 計測終了
if ($this->request->is(['patch', 'post', 'put'])) {
$post = $this->Posts->patchEntity($post, $this->request->data);
if ($this->Posts->save($post)) {
$this->Flash->success(__('The post has been saved.'));
- snip -
Reference
이 문제에 관하여(CakePHP3에서 처리 실행 시간을 측정하는 간단한 방법), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/k1LoW/items/7ac37ea64922edf284ef텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)