Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||||||
ID | ||||||||||||
0029696 | ||||||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
feature request | [Retail Modules] Web POS | minor | always | 2015-04-24 15:58 | 2015-04-24 15:58 | |||||||
Reporter | Orekaria | View Status | public | |||||||||
Assigned To | Retail | |||||||||||
Priority | normal | Resolution | open | Fixed in Version | ||||||||
Status | new | Fix in branch | Fixed in SCM revision | |||||||||
Projection | none | ETA | none | Target Version | ||||||||
OS | Any | Database | Any | Java version | ||||||||
OS Version | Database version | Ant version | ||||||||||
Product Version | SCM revision | |||||||||||
Review Assigned To | ||||||||||||
Regression level | ||||||||||||
Regression date | ||||||||||||
Regression introduced in release | ||||||||||||
Regression introduced by commit | ||||||||||||
Triggers an Emergency Pack | No | |||||||||||
Summary | 0029696: Add a sizeOf method to be able to know the size of the objects | |||||||||||
Description | Add a sizeOf method to be able to know the size of the objects This is useful to analyze user installations | |||||||||||
Steps To Reproduce | verify that the new method can calculate the size of the OB object | |||||||||||
Proposed Solution | Something like this: var memorySizeOf = function(obj) { var bytes = 0; function sizeOf(obj) { if(obj !== null && obj !== undefined) { switch(typeof obj) { case 'number': bytes += 8; break; case 'string': bytes += obj.length * 2; break; case 'boolean': bytes += 4; break; case 'object': var objClass = Object.prototype.toString.call(obj).slice(8, -1); if(objClass === 'Object' || objClass === 'Array') { for(var key in obj) { if(!obj.hasOwnProperty(key)) continue; sizeOf(obj[key]); } } else bytes += obj.toString().length * 2; break; } } return bytes; } function formatByteSize(bytes) { if(bytes < 1024) return bytes + " bytes"; else if(bytes < 1048576) return(bytes / 1024).toFixed(2) + " KiB"; else if(bytes < 1073741824) return(bytes / 1048576).toFixed(2) + " MiB"; else return(bytes / 1073741824).toFixed(2) + " GiB"; } return formatByteSize(sizeOf(obj)); }; | |||||||||||
Tags | No tags attached. | |||||||||||
Attached Files | ||||||||||||
![]() |
|
![]() |
|||
Date Modified | Username | Field | Change |
2015-04-24 15:58 | Orekaria | New Issue | |
2015-04-24 15:58 | Orekaria | Assigned To | => Retail |
2015-04-24 15:58 | Orekaria | Triggers an Emergency Pack | => No |
Copyright © 2000 - 2009 MantisBT Group |