예제 #1
0
파일: print.c 프로젝트: VURM/slurm
int _print_qos_priority_weighted(priority_factors_object_t * job, int width,
				 bool right, char* suffix)
{
	if (job == NULL)	/* Print the Header instead */
		_print_str("QOS", width, right, true);
	else if (job == (priority_factors_object_t *) -1)
		_print_int(weight_qos, width, right, true);
	else
		_print_int(job->priority_qos, width, right, true);
	if (suffix)
		printf("%s", suffix);
	return SLURM_SUCCESS;
}
예제 #2
0
static void _print_int( char **str, int *len, int num )
{
    char nstr[12];
    int i=10;
    
    if( num == 0 )
    {
        _print_char(str, len, '0');
    }

    if( num < 0 )
    {
        _print_char(str, len, '-');
        _print_int(str, len,  -1 * num );
        return;
    }
    nstr[11]='\0';
    
    while( (i>0) && num )
    {
        nstr[i] = '0' + (num % 10);
        num /= 10;
        i--;
    }

    _print_str(str, len, nstr + i+1);
}
예제 #3
0
void printf(const char *format, ...)
{
    char c;
    va_list ap;
    va_start(ap, format);
    while (c = *format++) {
        if (c == '%') {
            switch (c = *format++) {
                case 'd': {
                    int i = va_arg(ap, int);
                    _print_int(i);
                    break;
                }
                case 's': {
                    char *s = va_arg(ap, char*);
                    while (c = *s++)
                        putc(c, stdout);
                    break;
                }
                default: {
                    putc(c, stdout);
                    break;
                }
            }
        } else {
            putc(c, stdout);
        }
    }
예제 #4
0
파일: print.c 프로젝트: Cray/slurm
int _print_job_core_spec(job_info_t * job, int width, bool right, char* suffix)
{
	if (job == NULL) 	/* Print the Header instead */
		_print_str("CORE_SPEC", width, right, true);
	else
		_print_int(job->core_spec, width, right, true);
	return SLURM_SUCCESS;
}
예제 #5
0
파일: print.c 프로젝트: Cray/slurm
int _print_job_group_id(job_info_t * job, int width, bool right, char* suffix)
{
	if (job == NULL)	/* Print the Header instead */
		_print_str("GROUP", width, right, true);
	else
		_print_int(job->group_id, width, right, true);
	if (suffix)
		printf("%s", suffix);
	return SLURM_SUCCESS;
}
예제 #6
0
파일: print.c 프로젝트: Cray/slurm
int _print_step_num_tasks(job_step_info_t * step, int width, bool right,
			  char* suffix)
{
	if (step == NULL)	/* Print the Header instead */
		_print_str("TASKS", width, right, true);
	else
		_print_int(step->num_tasks, width, right, true);
	if (suffix)
		printf("%s", suffix);
	return SLURM_SUCCESS;
}
예제 #7
0
파일: print.c 프로젝트: Cray/slurm
int _print_step_user_id(job_step_info_t * step, int width, bool right,
			char* suffix)
{
	if (step == NULL)	/* Print the Header instead */
		_print_str("USER", width, right, true);
	else
		_print_int(step->user_id, width, right, true);
	if (suffix)
		printf("%s", suffix);
	return SLURM_SUCCESS;
}
예제 #8
0
파일: print.c 프로젝트: Cray/slurm
int _print_job_contiguous(job_info_t * job, int width, bool right_justify,
			  char* suffix)
{
	if (job == NULL)	/* Print the Header instead */
		_print_str("CONTIGUOUS", width, right_justify, true);
	else {
		_print_int(job->contiguous, width, right_justify, true);
	}

	if (suffix)
		printf("%s", suffix);
	return SLURM_SUCCESS;
}
예제 #9
0
파일: print.c 프로젝트: VURM/slurm
int _print_job_nice(priority_factors_object_t * job, int width,
				bool right, char* suffix)
{
	if (job == NULL)	/* Print the Header instead */
		_print_str("NICE", width, right, true);
	else if (job == (priority_factors_object_t *) -1)
		_print_str("", width, right, true);
	else
		_print_int(job->nice - NICE_OFFSET, width, right, true);
	if (suffix)
		printf("%s", suffix);
	return SLURM_SUCCESS;
}
예제 #10
0
파일: print.c 프로젝트: Cray/slurm
int _print_job_group_name(job_info_t * job, int width, bool right, char* suffix)
{
	struct group *group_info = NULL;

	if (job == NULL)	/* Print the Header instead */
		_print_str("GROUP", width, right, true);
	else {
		group_info = getgrgid((gid_t) job->group_id);
		if (group_info && group_info->gr_name[0])
			_print_str(group_info->gr_name, width, right, true);
		else
			_print_int(job->group_id, width, right, true);
	}
	if (suffix)
		printf("%s", suffix);
	return SLURM_SUCCESS;
}
예제 #11
0
파일: print.c 프로젝트: VURM/slurm
int _print_age_priority_normalized(priority_factors_object_t * job, int width,
				   bool right, char* suffix)
{
	if (job == NULL)	/* Print the Header instead */
		_print_str("AGE", width, right, true);
	else if (job == (priority_factors_object_t *) -1)
		_print_int(weight_age, width, right, true);
	else {
		double num = 0;
		if (weight_age)
			num = job->priority_age / weight_age;
		_print_norm(num, width, right, true);
	}
	if (suffix)
		printf("%s", suffix);
	return SLURM_SUCCESS;
}
예제 #12
0
파일: print.c 프로젝트: Cray/slurm
int _print_job_node_inx(job_info_t * job, int width, bool right, char* suffix)
{
	if (job == NULL)	/* Print the Header instead */
		_print_str("NODE_BY_INDEX", width, right, true);
	else {
		int *current = job->node_inx;
		int curr_width = 0;
		while (*current != -1 && curr_width < width) {
			if (curr_width)
				printf(",");
			curr_width += _print_int(*current, width, right, true);
			current++;
		}
		while (curr_width < width)
			curr_width += printf(" ");
	}
	if (suffix)
		printf("%s", suffix);
	return SLURM_SUCCESS;
}
예제 #13
0
void print_int( int num )
{
    int i = -1;
    _print_int( NULL, &i, num );
}