Openbravo Issue Tracking System - Retail Modules | |||||
| View Issue Details | |||||
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0029696 | Retail Modules | Web POS | public | 2015-04-24 15:58 | 2015-04-24 15:58 |
| Reporter | Orekaria | ||||
| Assigned To | Retail | ||||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | new | Resolution | open | ||
| Platform | OS | 5 | OS Version | ||
| Product Version | |||||
| Target Version | Fixed in Version | ||||
| Merge Request Status | |||||
| Review Assigned To | |||||
| OBNetwork customer | No | ||||
| Support ticket | |||||
| 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)); }; | ||||
| Additional Information | |||||
| Tags | No tags attached. | ||||
| Relationships | |||||
| Attached Files | |||||
| Issue History | |||||
| 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 | OBNetwork customer | => No | ||
| 2015-04-24 15:58 | Orekaria | Triggers an Emergency Pack | => No | ||
| There are no notes attached to this issue. |