[Erp5-report] r16805 - /erp5/trunk/products/ERP5Type/Tool/CacheTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Oct 3 17:21:51 CEST 2007
Author: ivan
Date: Wed Oct 3 17:21:51 2007
New Revision: 16805
URL: http://svn.erp5.org?rev=16805&view=rev
Log:
Add initial implementation of statistics method that will calculate total RAM memory usage
for cache and will return RAM usage per cache factory.
Modified:
erp5/trunk/products/ERP5Type/Tool/CacheTool.py
Modified: erp5/trunk/products/ERP5Type/Tool/CacheTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Tool/CacheTool.py?rev=16805&r1=16804&r2=16805&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Tool/CacheTool.py (original)
+++ erp5/trunk/products/ERP5Type/Tool/CacheTool.py Wed Oct 3 17:21:51 2007
@@ -213,3 +213,19 @@
if REQUEST is not None:
self.REQUEST.RESPONSE.redirect('cache_tool_configure?manage_tabs_message=Cache factory scope %s cleared.' %cache_factory_id)
+ def getCacheTotalMemorySize(self, REQUEST=None):
+ """ Calculate total size of memory used for cache.
+
+ Note: this method will calculate RAM memory usage for 'local'
+ (RamCache) cache plugins and will not include
+ 'shared' (DistributedRamCache and SQLCache) cache plugins."""
+ report = ''
+ total_size = 0
+ ram_cache_root = self.getRamCacheRoot()
+ for cf_key, cf_value in ram_cache_root.items():
+ for cp in cf_value.getCachePluginList():
+ cp_total_size = cp.getCachePluginTotalMemorySize()
+ total_size += cp_total_size
+ report += '\n%s:\t%s' %(cf_key, cp_total_size)
+ report += '\nTOTAL = %s' %(total_size)
+ return '%s;%s' %(total_size, report)
More information about the Erp5-report
mailing list