I am developing a timetable system using Yii. All working fine, but how can I get the time execution for a script or action.
For example, I have the action "scheduleOptimize". And I want to know how long does it take to run the action in PHP.
Somebody help me please.
Thanx in advance
Active Record automatically maintains the list of dirty attributes. It does so by maintaining an older version of the attribute values and comparing them with the latest one. You can call yii\db\ActiveRecord::getDirtyAttributes() to get the attributes that are currently dirty.
Conceptually Yii1 and Yii2 are quite similar, however Yii2 runs on newer PHP versions and utilizes namespaces, traits etc. Yii2 has also support for dependency injection through $container singleton available after initializing the framework.
Registering CSS files A CSS file can be registered using the following: $this->registerCssFile("@web/css/themes/black-and-white. css", [ 'depends' => [\yii\bootstrap\BootstrapAsset::class], 'media' => 'print', ], 'css-print-theme'); The above code will add a link to the /css/themes/black-and-white.
Simple snippet, returns execution time in seconds, 5 symbols after comma precision.
<?php echo sprintf('%0.5f',Yii::getLogger()->getExecutionTime())?>
Yes. You can do with Logging
option in yii
Refer this link.
http://www.yiiframework.com/doc/guide/1.1/en/topics.logging
you can do:
You don't need Yii to do it for you. Use native PHP.
$start_time = microtime(true);
//Do you stuff here
do_stuff('here');
$end_time = microtime(true);
//dividing with 60 will give the execution time in minutes other wise seconds
$execution_time = ($end_time - $start_time)/60;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With