Changeset - 0072103d825f
[Not reviewed]
default
0 2 0
LordOfWar - 16 years ago 2009-09-22 23:08:20

-added prev_frame_index to distrenjob queue
-mortition() now changes prev_frame_index to zero if the job is not completely done
-find_jobframe() now starts in the frameset array at prev_frame_index
-efficiency for finding every frame in the job goes from ((x^2)/2 where x = total_frames) to (3 * total_frames);
2 files changed with 6 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -181,12 +181,15 @@ void mortition(struct distrenjob *head, 
 
        }
 
    }
 

	
 
  if(isJobDone)
 
  if(isJobDone) // if all frames were accounted for
 
    {
 
      distrenjob_remove(head, job);
 
      distrenjob_free(&job);
 
      general_info.jobs_in_queue--;
 
    }
 
  else{
 
    job->prev_frame_index = 0; // if the job isn't done, have frame_finder() start from the first frame, allowing it to see the frames that are now unassigned
 
  }
 
}
 

	
 
/**
 
@@ -298,7 +301,7 @@ int find_jobframe(struct distrenjob *hea
 
  found = 0;
 
  /* iterate through jobs from first to last */
 
  for(distrenjob_ptr = head->next; (!found && !distrenjob_ptr) && !distrenjob_ptr->hibernate; distrenjob_ptr = distrenjob_ptr->next)
 
    for(frame_counter = 0; !found && frame_counter < distrenjob_ptr->total_frames; frame_counter ++)
 
    for(frame_counter = distrenjob_ptr->prev_frame_index; !found && frame_counter < distrenjob_ptr->total_frames; frame_counter ++)
 
      if(distrenjob_ptr->frameset[frame_counter].status == FRAMESETSTATUS_UNASSIGNED)
 
	{
 
	  found = 1;
src/server/distrenjob.h
Show inline comments
 
@@ -45,6 +45,7 @@ struct distrenjob {
 
  int total_frames; // how many frames are in the animation for stats/etc (unassigned frames)
 
  int watchdog_forgiveness; // how many seconds till the frame is re-assigned (if client computer crashes etc);
 
  short int hibernate;
 
  int prev_frame_index; // the position in the array of the last frame that was assigned
 
  time_t total_render_time; // total seconds of time spent on all the completed frames
 
  char *output_format; /*< currently is the file extention of the request output format. @todo make this mime-type based/not a string */
 
  struct frameset *frameset;
0 comments (0 inline, 0 general)