0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

LaravelAdvent Calendar 2022

Day 1

【artisan】shell_exec実行時のユーザーCPU時間【Laravel】timeコマンドのuser

Posted at

shell_execでも同様の結果となる

composer create-project laravel/laravel example-app
cd example-app

./artisan make:command shell_exec
./artisan command:name

wget https://gist.githubusercontent.com/hellowork-mhlw/03344d342fffa767e6a6ffd7b89a93ed/raw/cnt.c
gcc cnt.c

# 下記からコードをコピペ
# https://qiita.com/foluyucic/items/158f1759a372fed6a1ff

$ time ./artisan command:name sleep 3

real    0m3.114s
user    0m0.086s
sys     0m0.030s

$ time ./artisan command:name ./a.out
500000000500000000

real    0m1.044s
user    0m1.008s
sys     0m0.035s

$ time ./a.out
500000000500000000
real    0m0.914s
user    0m0.912s
sys     0m0.001s

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?