Andreas.Lenz++at++esg.de
Date: 08/19/2003 22:41:59
I'm still experiencing drastic performance problems in my terrain
visualisation application.
As far as i can see, the problem arises within my database function,
which handles the paging of tiles. Here is, how my database function
basically works:
(the application itself is based on perfly sample code)
...
pfNode* Tiles[MAX_TILES];
t_vis_tile Tile_List[MAX_TILES]; // List of tiles with current state,
coordinates,...
...
/*********************************************************/
void myDBaseFunc (void)
/*********************************************************/
{
static int init = 1;
static int page_cnt = 0;
static pfBuffer *Buffer = NULL;
static pfGroup *Root = NULL;
static long inside = 0; // number of tiles in paging area
// Init on first call of function
if (Buffer == NULL)
{
Buffer = new pfBuffer;
Buffer->select();
}
if(init)
{
init = 0;
init_terrain_files(); // scan dir for all *.pfb's and get the
// coordinates of the related tiles
Root = new pfGroup; // Is this needed ?
}
// get eyepoint position lat, lon
// and calculate paging area
Page_Area[...] = rectangle around lat, lon .....
// Loop over all tiles to see which tiles are inside paging area
for(k=0; k < ViewState->num_tiles; k++)
{
if(tile_inside_page_area (&Tile_List[k]))
{
if(Tile_List[k].state != TILE_STATE_PAGED // Tile is
visible an not yet paged
Tile_List[k].action = TILE_ACTION_LOAD; // mark tile to
be loaded later
inside ++;
}
else
{
Tile_List[k].action = TILE_ACTION_DELETE; // other tiles
should be deleted
}
}
// Loop over all tiles to delete those which are removed an have ref
==0
for(k=0; k < ViewState->num_tiles; k++)
{
if ((Tile_List[k].state == TILE_STATE_REMOVED) &&
( pfGetRef( Tiles[k] ) == 0))
{
pfAsyncDelete( Tiles[k] );
Tile_List[k].state = TILE_STATE_NOT_PAGED;
}
}
// Loop over all tiles, looking for paged tiles which have
// to be removed
for(k=0; k < ViewState->num_tiles; k++)
{
if ( (Tile_List[k].action == TILE_ACTION_DELETE) &&
(Tile_List[k].state == TILE_STATE_PAGED) )
{
Buffer->remove(ViewState->scene, Tiles[k]); // Remove
tile from scene
//
ViewState->scene is the global scene
Tile_List[k].state = TILE_STATE_REMOVED;
}
}
// Loop over all tiles, searching for tiles to be loaded
for(k=0; k < ViewState->num_tiles; k++)
{
if ( (Tile_List[k].action == TILE_ACTION_LOAD) && // inside
paging area
(Tile_List[k].state == TILE_STATE_NOT_PAGED) ) // not
yet paged
{
// get filename belonging to tile ....
strcpy (file, filename);
Tiles[k] = pfdLoadFile(file); // load
tile as PFB file
Buffer->add(ViewState->scene, Tiles[k]); // add to
buffer
Tile_List[k].state = TILE_STATE_PAGED;
}
}
if ( something was changed... )
{
// merging of scene buffer
Buffer->merge();
}
pfDBase();
}
Here is the description of my problem:
When the eyepoint moves along the terrain, new tiles are loaded and old
tiles are removed from the scene. It happens, that my database function
calls pfDBase() but does not return from that call for a few seconds.
This delay only seems to occur after calls to pfAsyncDelete().
If i call pfAsyncDelete() for more than one tile in the same execution
cycle pfDBase() may take up to 30 seconds before returning, consuming
100% of one CPU. The delay typically takes place 2 or 3 cycles after the
call to pfAsyncDelete().
As a result, no new tiles can be loaded while the eyepoint still moves
along the terain.
I don't know the size of the tiles in memory, but the correspondig *.pfb
files are typically about 3 MByte. Textures are not included in the pfb's
and have to be loaded additionally.
My hardware is a dual XEON PC, 2 x 2Ghz (which gives me virtually 4 CPU's)
with 1 GB RAM,running Suse-Linux 7.3 with kernel 2.4.18 and NVIDIA GeForce4
ti4600 with latest drivers.
The question is, why pfDBase() takes that much of time after a call to
pfAsycDelete() ?
Also i'm not sure, if i do the loading, adding and removing of tiles to the
scene correctly.
Any help is welcome. If you need further information about my application,
please ask. I don't know which lines of code, except for the database
function, are related to this problem.
Thanks Andreas !
------------------------------------------------------------
Andreas Lenz ESG GmbH
Einsteinstrasse 174 D-81675 München
Tel.: ++49-89-9216-2167
Fax.: ++49-89-9216-2632
Mail: Andreas.Lenz++at++esg.de
------------------------------------------------------------
This archive was generated by hypermail 2b29 : Tue Aug 19 2003 - 23:23:03 PDT