|
Lines 49-54
Link Here
|
| 49 |
static void _help( void ); |
49 |
static void _help( void ); |
| 50 |
static void _usage( void ); |
50 |
static void _usage( void ); |
| 51 |
|
51 |
|
|
|
52 |
static void _opt_env(void) |
| 53 |
{ |
| 54 |
char *env_val; |
| 55 |
|
| 56 |
if ((env_val = getenv("SLURM_CLUSTERS"))) { |
| 57 |
if (!(params.clusters = slurmdb_get_info_cluster(env_val))) { |
| 58 |
print_db_notok(env_val, 1); |
| 59 |
exit(1); |
| 60 |
} |
| 61 |
} |
| 62 |
} |
| 63 |
|
| 52 |
/* |
64 |
/* |
| 53 |
* parse_command_line, fill in params data structure with data |
65 |
* parse_command_line, fill in params data structure with data |
| 54 |
*/ |
66 |
*/ |
|
Lines 61-66
extern void parse_command_line(int argc, char **argv)
Link Here
|
| 61 |
{"help", no_argument, 0, 'h'}, |
73 |
{"help", no_argument, 0, 'h'}, |
| 62 |
{"reset", no_argument, 0, 'r'}, |
74 |
{"reset", no_argument, 0, 'r'}, |
| 63 |
{"sort-by-id", no_argument, 0, 'i'}, |
75 |
{"sort-by-id", no_argument, 0, 'i'}, |
|
|
76 |
{"cluster", required_argument, 0, 'M'}, |
| 77 |
{"clusters", required_argument, 0, 'M'}, |
| 64 |
{"sort-by-time",no_argument, 0, 't'}, |
78 |
{"sort-by-time",no_argument, 0, 't'}, |
| 65 |
{"sort-by-time2",no_argument, 0, 'T'}, |
79 |
{"sort-by-time2",no_argument, 0, 'T'}, |
| 66 |
{"usage", no_argument, 0, OPT_LONG_USAGE}, |
80 |
{"usage", no_argument, 0, OPT_LONG_USAGE}, |
|
Lines 72-78
extern void parse_command_line(int argc, char **argv)
Link Here
|
| 72 |
params.mode = STAT_COMMAND_GET; |
86 |
params.mode = STAT_COMMAND_GET; |
| 73 |
params.sort = SORT_COUNT; |
87 |
params.sort = SORT_COUNT; |
| 74 |
|
88 |
|
| 75 |
while ((opt_char = getopt_long(argc, argv, "ahirtTV", long_options, |
89 |
/* get defaults from environment */ |
|
|
90 |
_opt_env(); |
| 91 |
|
| 92 |
while ((opt_char = getopt_long(argc, argv, "ahiM:rtTV", long_options, |
| 76 |
&option_index)) != -1) { |
93 |
&option_index)) != -1) { |
| 77 |
switch (opt_char) { |
94 |
switch (opt_char) { |
| 78 |
case (int)'a': |
95 |
case (int)'a': |
|
Lines 85-90
extern void parse_command_line(int argc, char **argv)
Link Here
|
| 85 |
case (int)'i': |
102 |
case (int)'i': |
| 86 |
params.sort = SORT_ID; |
103 |
params.sort = SORT_ID; |
| 87 |
break; |
104 |
break; |
|
|
105 |
case (int)'M': |
| 106 |
if (params.clusters) |
| 107 |
FREE_NULL_LIST(params.clusters); |
| 108 |
if (!(params.clusters = slurmdb_get_info_cluster(optarg))) { |
| 109 |
print_db_notok(optarg, 0); |
| 110 |
exit(1); |
| 111 |
} |
| 112 |
break; |
| 88 |
case (int)'r': |
113 |
case (int)'r': |
| 89 |
params.mode = STAT_COMMAND_RESET; |
114 |
params.mode = STAT_COMMAND_RESET; |
| 90 |
break; |
115 |
break; |
|
Lines 104-109
extern void parse_command_line(int argc, char **argv)
Link Here
|
| 104 |
break; |
129 |
break; |
| 105 |
} |
130 |
} |
| 106 |
} |
131 |
} |
|
|
132 |
|
| 133 |
if (params.clusters) { |
| 134 |
if (list_count(params.clusters) > 1) { |
| 135 |
fatal("Only one cluster can be used at a time with " |
| 136 |
"sdiag"); |
| 137 |
} |
| 138 |
working_cluster_rec = list_peek(params.clusters); |
| 139 |
} |
| 107 |
} |
140 |
} |
| 108 |
|
141 |
|
| 109 |
|
142 |
|
|
Lines 119-124
Usage: sdiag [OPTIONS]\n\
Link Here
|
| 119 |
-a all statistics\n\ |
152 |
-a all statistics\n\ |
| 120 |
-r reset statistics\n\ |
153 |
-r reset statistics\n\ |
| 121 |
\nHelp options:\n\ |
154 |
\nHelp options:\n\ |
|
|
155 |
--cluster direct the request to a specific cluster\n\ |
| 122 |
--help show this help message\n\ |
156 |
--help show this help message\n\ |
| 123 |
--sort-by-id sort RPCs by id\n\ |
157 |
--sort-by-id sort RPCs by id\n\ |
| 124 |
--sort-by-time sort RPCs by total run time\n\ |
158 |
--sort-by-time sort RPCs by total run time\n\ |