File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -86,10 +86,14 @@ void _mi_stat_adjust_decrease(mi_stat_count_t* stat, size_t amount) {
8686static void mi_stat_count_add_mt (mi_stat_count_t * stat , const mi_stat_count_t * src ) {
8787 if (stat == src ) return ;
8888 mi_atomic_void_addi64_relaxed (& stat -> total , & src -> total );
89-
90- int64_t prev_current = mi_atomic_addi64_relaxed (& stat -> current , src -> current );
91-
92- // global current plus thread peak approximates new global peak
89+ const int64_t prev_current = mi_atomic_addi64_relaxed (& stat -> current , src -> current );
90+
91+ // Global current plus thread peak approximates new global peak
92+ // note: peak scores do really not work across threads.
93+ // we used to just add them together but that often overestimates in practice.
94+ // similarly, max does not seem to work well. The current approach
95+ // by Artem Kharytoniuk (@artem-lunarg) seems to work better, see PR#1112
96+ // for a longer description.
9397 mi_atomic_maxi64_relaxed (& stat -> peak , prev_current + src -> peak );
9498}
9599
You can’t perform that action at this time.
0 commit comments