TODO: Additional statistics to gather - How many objects are added on average between each destroyed object - How many objects are added on average between each detected object - how many iterations are needed for each destroyed object - how many iterations are needed for each detected object The average must have a decay so that long running applications will not suffer from objects being creat
| 267 | // When returning the average it should use a weighted average between the two buckets using the size as weight. |
| 268 | // When a bucket is filled up, the buckets are switched, and then new bucket is emptied to gather new statistics. |
| 269 | void asCGarbageCollector::GetStatistics(asUINT *currentSize, asUINT *totalDestroyed, asUINT *totalDetected, asUINT *newObjects, asUINT *totalNewDestroyed) const |
| 270 | { |
| 271 | // It is not necessary to protect this with critical sections, however |
| 272 | // as it is not protected the variables can be filled in slightly different |
| 273 | // moments and might not match perfectly when inspected by the application |
| 274 | // afterwards. |
| 275 | |
| 276 | if( currentSize ) |
| 277 | *currentSize = (asUINT)(gcNewObjects.GetLength() + gcOldObjects.GetLength()); |
| 278 | |
| 279 | if( totalDestroyed ) |
| 280 | *totalDestroyed = numDestroyed; |
| 281 | |
| 282 | if( totalDetected ) |
| 283 | *totalDetected = numDetected; |
| 284 | |
| 285 | if( newObjects ) |
| 286 | *newObjects = (asUINT)gcNewObjects.GetLength(); |
| 287 | |
| 288 | if( totalNewDestroyed ) |
| 289 | *totalNewDestroyed = numNewDestroyed; |
| 290 | } |
| 291 | |
| 292 | asCGarbageCollector::asSObjTypePair asCGarbageCollector::GetNewObjectAtIdx(int idx) |
| 293 | { |
no test coverage detected