Changeset - 4ead21d5a929
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 16 years ago 2009-07-13 22:04:22
ohnobinki@ohnopublishing.net
make struct blendjob into a linked list
1 file changed with 10 insertions and 11 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -73,37 +73,38 @@ struct distrend_config
 
*/
 

	
 
struct general_info {
 
	short int jobs_in_queue; //
 
	unsigned short int free_clients;
 
	unsigned short int rendering_clients;//
 
	unsigned short int total_finished_jobs; //
 
	unsigned int total_frames_rendered; //
 
} general_info;
 

	
 
// Stores Blender Job Info
 
struct blendjob {
 
  struct blendjob *next; /* next will be NULL unless if there is another blendjob */
 
  char *name;
 
  char *submitter;
 
  char *email;
 
  int priority;  // 1 is lowest, 10 is highest, 0 is done
 
  int percent_done;
 
  int completed_frames; // number of completed frames for stats/etc
 
  int assigned_frames; // number of assigned frames (that are not yet completed) for stats/etc
 
  int total_frames; // how many frames are in the animation for stats/etc
 
  int avg_render_time; // average seconds it took to render a frame
 
  unsigned int time_remaining; // estimated seconds remaining till render is complete (up to 49, 710 days)
 
							   // we can have the client computer convert it into days, hours, etc if they wish to view it
 
  struct frameset *frameset;
 
} blendjob[MAX_BLENDJOBS];
 
};
 

	
 

	
 
// Frameset Structure
 
struct frameset {
 
	int frame_num; // frame number to render
 
	char slave_name; // user that frame is assigned to
 
	int frame_status; // status of frame, 0= unassigned, 1= taken, 2= done
 
	clock_t start_time; // time the frame was started
 
	int time_to_render; // the total seconds it took to render the frame
 
} frameset[]; // Frameset array is generated by status_report_generator function
 
                         // Using this method to save memory, because if animation starts on a high frame number, it would waste a lot of RAM on empty structures
 

	
 
@@ -201,37 +202,35 @@ void status_report_generator(){
 
				}
 
			}
 

	
 
			num1++;
 
			general_info.rendering_clients = workers_working;
 
		}
 

	
 
		general_info.jobs_in_queue = (highest_jobnum - general_info.total_finished_jobs);
 
	}
 

	
 

	
 
// **** Structure Builder: This function creates frame array based on the total number of frames to be rendered, which will then be parsed by function frame_farmer.
 
void frame_num_struct_builder(int sframe, int eframe) {
 
	int jobnum_new = highest_jobnum + 1;
 
	int total = (sframe - eframe) +1;  // total number of frames
 
	int fcount = sframe; // Used to create all the frames in the structure from sframe to eframe
 
	int x = 0;
 
void frame_num_struct_builder(struct blendjob *job, unsigned int numframes) {
 
  int jobnum_new = highest_jobnum + 1; /* global vars will someday leave us  */
 
	int counter;
 

	
 
	
 

	
 
	blendjob[jobnum_new].total_frames = total; // sets the total number of frames in animation for status purposes
 

	
 
	while(x < total){ // This builds the array, with the array starting at zero and the frame_num starting at sframe
 
		blendjob[jobnum_new].frameset[x].frame_num = fcount;
 
		x++;
 
		fcount++;
 
	}
 
	for(counter = 0; counter < total; counter ++)
 
	  /* This builds the array, with the array starting at zero and the frame_num starting at sframe */
 
	  blendjob[jobnum_new].frameset[x].frame_num = counter + 1;
 

	
 
	highest_jobnum++; // After it has created the job, it adds one to the highest_jobnum interger
 
}
 

	
 

	
 

	
 
// Frame Assigner: matches your computer up with a lovely frame to render
 
int frame_finder(){
 
	int your_frame = 0;  // your_frame is an interger value that will be given to the client as the frame number to render
 
	int finder_jobnum = 0;
 
	int frameset_count = 0; // the frameset number, note* frames in an animation don't start at zero
 
	short int done = 0;
0 comments (0 inline, 0 general)