~ubuntu-branches/ubuntu/vivid/slurm-llnl/vivid

« back to all changes in this revision

Viewing changes to src/sreport/common.c

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2009-09-24 23:28:15 UTC
  • mfrom: (1.1.11 upstream) (3.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090924232815-enh65jn32q1ebg07
Tags: 2.0.5-1
* New upstream release 
* Changed dependecy from lib-mysqlclient15 to lib-mysqlclient 
* Added Default-Start for runlevel 2 and 4 and $remote_fs requirement in
  init.d scripts (Closes: #541252)
* Postinst checks for wrong runlevels 2 and 4 links
* Upgraded to standard version 3.8.3
* Add lintian overrides for missing slurm-llnl-configurator.html in doc
  base registration
* modified postrm scripts to ignore pkill return value in order to avoid
  postrm failure when no slurm process is running
* Checking for slurmctld.pid before cancelling running and pending
  jobs during package removal 

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 *  Copyright (C) 2008 Lawrence Livermore National Security.
7
7
 *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
8
8
 *  Written by Danny Auble <da@llnl.gov>
9
 
 *  LLNL-CODE-402394.
 
9
 *  CODE-OCEC-09-009. All rights reserved.
10
10
 *  
11
11
 *  This file is part of SLURM, a resource management program.
12
 
 *  For details, see <http://www.llnl.gov/linux/slurm/>.
 
12
 *  For details, see <https://computing.llnl.gov/linux/slurm/>.
 
13
 *  Please also read the included file: DISCLAIMER.
13
14
 *  
14
15
 *  SLURM is free software; you can redistribute it and/or modify it under
15
16
 *  the terms of the GNU General Public License as published by the Free
42
43
extern void sreport_print_time(print_field_t *field,
43
44
                               uint64_t value, uint64_t total_time, int last)
44
45
{
 
46
        int abs_len = abs(field->len);
 
47
 
45
48
        if(!total_time) 
46
49
                total_time = 1;
47
50
 
54
57
                else if(print_fields_parsable_print)
55
58
                        printf("|");    
56
59
                else                            
57
 
                        printf("%-*s ", field->len, " ");
 
60
                        printf("%-*s ", abs_len, " ");
58
61
        } else {
59
62
                char *output = NULL;
60
63
                double percent = (double)value;
109
112
                        printf("%s", output);
110
113
                else if(print_fields_parsable_print)
111
114
                        printf("%s|", output);  
 
115
                else if(field->len == abs_len)
 
116
                        printf("%*.*s ", abs_len, abs_len, output);
112
117
                else
113
 
                        printf("%*.*s ", field->len, field->len, output);
 
118
                        printf("%-*.*s ", abs_len, abs_len, output);
 
119
 
114
120
                xfree(output);
115
121
        }
116
122
}
433
439
        return 0;
434
440
}
435
441
 
 
442
/* 
 
443
 * Comparator used for sorting resvs largest cpu to smallest cpu
 
444
 * 
 
445
 * returns: 1: resv_a > resv_b   0: resv_a == resv_b   -1: resv_a < resv_b
 
446
 * 
 
447
 */
 
448
extern int sort_reservations_dec(acct_reservation_rec_t *resv_a, 
 
449
                                 acct_reservation_rec_t *resv_b)
 
450
{
 
451
        int diff = 0;
 
452
 
 
453
        if(!resv_a->cluster || !resv_b->cluster)
 
454
                return 0;
 
455
 
 
456
        diff = strcmp(resv_a->cluster, resv_b->cluster);
 
457
 
 
458
        if (diff > 0)
 
459
                return 1;
 
460
        else if (diff < 0)
 
461
                return -1;
 
462
 
 
463
        if(!resv_a->name || !resv_b->name)
 
464
                return 0;
 
465
 
 
466
        diff = strcmp(resv_a->name, resv_b->name);
 
467
 
 
468
        if (diff > 0)
 
469
                return 1;
 
470
        else if (diff < 0)
 
471
                return -1;
 
472
        
 
473
        if(resv_a->time_start < resv_b->time_start)
 
474
                return 1;
 
475
        else if(resv_a->time_start > resv_b->time_start)
 
476
                return -1;
 
477
 
 
478
        return 0;
 
479
}
 
480
 
436
481
extern int get_uint(char *in_value, uint32_t *out_value, char *type)
437
482
{
438
483
        char *ptr = NULL, *meat = NULL;