View Issue Details

IDProjectCategoryView StatusLast Update
0000520LDMud 3.3Runtimepublic2018-01-29 21:57
Reporterzesstra Assigned Tolars 
PrioritynormalSeverityminorReproducibilityN/A
Status resolvedResolutionfixed 
Product Version3.3 
Fixed in Version3.3.716 
Summary0000520: Overflow of apply_cache_hit, apply_cache_miss causing wrong statistics
Description'status tables' gave me the following info about the apply cache:
Apply Cache:
------------
Calls to apply_low: 4042499944
Cache hits: 3902887001 (155.30%)

apply_cache_hit and apply_cache_miss in interpret.c|h are of type p_int and outputted as unsigned long in the 'status' command. Obviously, 'signed long' (p_int) overflowed.
For both variables only positive values are of interest, therefore I suggest to change their type to p_uint (s. attached patch).
Of course, this doesn't solve the overflow problem. ;-) A possibility may be to decay both values by a constant factor from time to time, e.g. in a function like wiz_decay() called by the backend. Any opinions on this?
TagsNo tags attached.
Attached Files
apply_cache.diff (874 bytes)   
diff -ur trunk/src/interpret.c trunk.mod/src/interpret.c
--- trunk/src/interpret.c	2007-10-12 21:01:11.000000000 +0200
+++ trunk.mod/src/interpret.c	2007-10-12 21:02:25.000000000 +0200
@@ -611,8 +611,8 @@
    */
 
 #ifdef APPLY_CACHE_STAT
-p_int apply_cache_hit  = 0;
-p_int apply_cache_miss = 0;
+p_uint apply_cache_hit  = 0;
+p_uint apply_cache_miss = 0;
   /* Number of hits and misses in the apply cache.
    */
 #endif
diff -ur trunk/src/interpret.h trunk.mod/src/interpret.h
--- trunk/src/interpret.h	2007-10-12 21:01:11.000000000 +0200
+++ trunk.mod/src/interpret.h	2007-10-12 21:02:33.000000000 +0200
@@ -111,8 +111,8 @@
 extern svalue_t last_indexing_protector;
 
 #ifdef APPLY_CACHE_STAT
-extern p_int apply_cache_hit;
-extern p_int apply_cache_miss;
+extern p_uint apply_cache_hit;
+extern p_uint apply_cache_miss;
 #endif
 
 extern unsigned long total_evalcost;
apply_cache.diff (874 bytes)   

Activities

lars

2007-10-13 23:30

reporter   ~0000567

Implemented the patch. If overflows continue to be a problem, we may want to move to a gigahit/hit counter approach (like we do with VM ticks).

Issue History

Date Modified Username Field Change
2007-10-12 13:25 zesstra New Issue
2007-10-12 13:26 zesstra File Added: apply_cache.diff
2007-10-13 23:30 lars Status new => resolved
2007-10-13 23:30 lars Fixed in Version => 3.3.716
2007-10-13 23:30 lars Resolution open => fixed
2007-10-13 23:30 lars Assigned To => lars
2007-10-13 23:30 lars Note Added: 0000567
2010-11-16 09:42 lars Source_changeset_attached => ldmud.git master 720d8316
2018-01-29 18:59 lars Source_changeset_attached => ldmud.git master 720d8316
2018-01-29 21:57 lars Source_changeset_attached => ldmud.git master 720d8316