Inaugural checkin: Tile accounting app/tile_cache.c app/tile.c

1999-12-05 Garry R. Osgood <gosgood@idt.net>
	Inaugural checkin: Tile accounting
	* app/tile_cache.c
	* app/tile.c

	cur_cache_dirty in tile_cache.c was not being fully updated. Fewer
	dirty bytes were being added to this global than what were being
	placed on the dirty tile queue. Deductions, however, were correct
	sometimes causing cur_cache_dirty to wrap around zero and become
	large positive. This skewed the number of tiles to be swapped to disk,
	usually downward, but sometimes dramatically upward.
        active_tile_count, (tile.c) currently a diagnostic counter, was
	not being decremented.

	Full patch documentation at
	http://idt.net/~gosgood/gimp-patch/patch01.html#991205-0
This commit is contained in:
Garry R. Osgood 1999-12-05 20:31:50 +00:00 committed by Garry R. Osgood
parent 2e9aa8bb9c
commit 843f496ddb
5 changed files with 33 additions and 6 deletions

View File

@ -1,3 +1,20 @@
1999-12-05 Garry R. Osgood <gosgood@idt.net>
Inaugural checkin: Tile accounting
* app/tile_cache.c
* app/tile.c
cur_cache_dirty in tile_cache.c was not being fully updated. Fewer
dirty bytes were being added to this global than what were being
placed on the dirty tile queue. Deductions, however, were correct
sometimes causing cur_cache_dirty to wrap around zero and become
large positive. This skewed the number of tiles to be swapped to disk,
usually downward, but sometimes dramatically upward.
active_tile_count, (tile.c) currently a diagnostic counter, was
not being decremented when tiles were actually destroyed.
Full patch documentation at
http://idt.net/~gosgood/gimp-patch/patch01.html#991205-0
1999-12-04 Michael Natterer <mitch@gimp.org>
* app/main.c

View File

@ -131,7 +131,12 @@ tile_cache_insert (Tile *tile)
else newlist->first = tile;
newlist->last = tile;
if (tile->dirty)
/* gosgood@idt.net 1999-12-04 */
/* bytes on cur_cache_dirty miscounted in CVS 1.12: */
/* Invariant: test for selecting dirty list should be the same */
/* as counting files dirty. */
if ((tile->dirty) || ( tile->swap_offset == -1))
{
cur_cache_dirty += tile_size (tile);
if (1)
@ -287,7 +292,7 @@ tile_idle_thread (void *data)
TILE_MUTEX_LOCK (tile);
CACHE_LOCK;
if (tile->dirty)
if (tile->dirty || tile->swap == -1)
{
list = tile->listhead;

View File

@ -153,6 +153,7 @@ tile_release (Tile *tile, int dirty)
if (tile->ref_count == 0)
{
tile_active_count--;
if (tile->share_count == 0)
{
/* tile is dead */
@ -165,7 +166,6 @@ tile_release (Tile *tile, int dirty)
tile cache */
tile_cache_insert (tile);
}
tile_active_count--;
}
TILE_MUTEX_UNLOCK (tile);

View File

@ -153,6 +153,7 @@ tile_release (Tile *tile, int dirty)
if (tile->ref_count == 0)
{
tile_active_count--;
if (tile->share_count == 0)
{
/* tile is dead */
@ -165,7 +166,6 @@ tile_release (Tile *tile, int dirty)
tile cache */
tile_cache_insert (tile);
}
tile_active_count--;
}
TILE_MUTEX_UNLOCK (tile);

View File

@ -131,7 +131,12 @@ tile_cache_insert (Tile *tile)
else newlist->first = tile;
newlist->last = tile;
if (tile->dirty)
/* gosgood@idt.net 1999-12-04 */
/* bytes on cur_cache_dirty miscounted in CVS 1.12: */
/* Invariant: test for selecting dirty list should be the same */
/* as counting files dirty. */
if ((tile->dirty) || ( tile->swap_offset == -1))
{
cur_cache_dirty += tile_size (tile);
if (1)
@ -287,7 +292,7 @@ tile_idle_thread (void *data)
TILE_MUTEX_LOCK (tile);
CACHE_LOCK;
if (tile->dirty)
if (tile->dirty || tile->swap == -1)
{
list = tile->listhead;