diff --git a/app/code/community/Aoe/Scheduler/Block/Adminhtml/Scheduler/Grid.php b/app/code/community/Aoe/Scheduler/Block/Adminhtml/Scheduler/Grid.php index ca830c5..e234aed 100755 --- a/app/code/community/Aoe/Scheduler/Block/Adminhtml/Scheduler/Grid.php +++ b/app/code/community/Aoe/Scheduler/Block/Adminhtml/Scheduler/Grid.php @@ -151,6 +151,15 @@ protected function _prepareColumns() 'frame_callback' => array($this, 'decorateMessages') ) ); + $this->addColumn( + 'memory_usage', + array( + 'header' => $this->__('Memory Usage'), + 'index' => 'memory_usage', + 'type' => 'number', + 'renderer' => 'aoe_scheduler/adminhtml_scheduler_renderer_memory', + ) + ); $this->addColumn( 'host', array( diff --git a/app/code/community/Aoe/Scheduler/Block/Adminhtml/Scheduler/Renderer/Memory.php b/app/code/community/Aoe/Scheduler/Block/Adminhtml/Scheduler/Renderer/Memory.php new file mode 100644 index 0000000..feed7cd --- /dev/null +++ b/app/code/community/Aoe/Scheduler/Block/Adminhtml/Scheduler/Renderer/Memory.php @@ -0,0 +1,14 @@ +getMemoryUsage(); + if ($value) { + return number_format($row->getMemoryUsage(), 2) . ' MB'; + } + return parent::render($row); + } +} diff --git a/app/code/community/Aoe/Scheduler/Model/Schedule.php b/app/code/community/Aoe/Scheduler/Model/Schedule.php index 1637a26..6851412 100755 --- a/app/code/community/Aoe/Scheduler/Model/Schedule.php +++ b/app/code/community/Aoe/Scheduler/Model/Schedule.php @@ -261,6 +261,7 @@ public function runNow($tryLockJob = true, $forceRun = false) } $this->setFinishedAt(strftime('%Y-%m-%d %H:%M:%S', time())); + $this->setMemoryUsage(memory_get_usage() / pow(1024, 2)); // convert bytes to megabytes Mage::dispatchEvent('cron_' . $this->getJobCode() . '_after', array('schedule' => $this)); Mage::dispatchEvent('cron_after', array('schedule' => $this)); diff --git a/app/code/community/Aoe/Scheduler/etc/config.xml b/app/code/community/Aoe/Scheduler/etc/config.xml index c8e9d4f..37641ba 100755 --- a/app/code/community/Aoe/Scheduler/etc/config.xml +++ b/app/code/community/Aoe/Scheduler/etc/config.xml @@ -2,7 +2,7 @@ - 1.4.0 + 1.5.0 diff --git a/app/code/community/Aoe/Scheduler/sql/aoescheduler_setup/mysql4-upgrade-1.4.0-1.5.0.php b/app/code/community/Aoe/Scheduler/sql/aoescheduler_setup/mysql4-upgrade-1.4.0-1.5.0.php new file mode 100644 index 0000000..2ac07c5 --- /dev/null +++ b/app/code/community/Aoe/Scheduler/sql/aoescheduler_setup/mysql4-upgrade-1.4.0-1.5.0.php @@ -0,0 +1,16 @@ +startSetup(); + +$installer->getConnection()->addColumn($installer->getTable('cron/schedule'), 'memory_usage', array( + 'type' => Varien_Db_Ddl_Table::TYPE_DECIMAL, + 'length' => '12,4', + 'unsigned' => true, + 'nullable' => true, + 'default' => null, + 'comment' => 'Memory Used in MB', +)); + +$installer->endSetup(); diff --git a/app/design/adminhtml/default/default/template/aoe_scheduler/timeline_detail.phtml b/app/design/adminhtml/default/default/template/aoe_scheduler/timeline_detail.phtml index 6b1a469..f21ec4c 100644 --- a/app/design/adminhtml/default/default/template/aoe_scheduler/timeline_detail.phtml +++ b/app/design/adminhtml/default/default/template/aoe_scheduler/timeline_detail.phtml @@ -58,6 +58,10 @@ $_helper = $this->helper('aoe_scheduler/data'); /* @var $_helper Aoe_Scheduler_H + + __('Memory Usage') ?>: + getMemoryUsage(), 2) . ' MB'; ?> +