| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: intrctl.c,v 1.4 2016/10/15 12:06:27 jdolecek Exp $ */ | | 1 | /* $NetBSD: intrctl.c,v 1.5 2016/10/15 12:14:00 jdolecek Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2015 Internet Initiative Japan Inc. | | 4 | * Copyright (c) 2015 Internet Initiative Japan Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -17,27 +17,27 @@ | | | @@ -17,27 +17,27 @@ |
17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 | * POSSIBILITY OF SUCH DAMAGE. | | 26 | * POSSIBILITY OF SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | #include <sys/cdefs.h> | | 29 | #include <sys/cdefs.h> |
30 | __RCSID("$NetBSD: intrctl.c,v 1.4 2016/10/15 12:06:27 jdolecek Exp $"); | | 30 | __RCSID("$NetBSD: intrctl.c,v 1.5 2016/10/15 12:14:00 jdolecek Exp $"); |
31 | | | 31 | |
32 | #include <sys/param.h> | | 32 | #include <sys/param.h> |
33 | #include <sys/sysctl.h> | | 33 | #include <sys/sysctl.h> |
34 | #include <sys/intrio.h> | | 34 | #include <sys/intrio.h> |
35 | #include <sys/types.h> | | 35 | #include <sys/types.h> |
36 | | | 36 | |
37 | #include <err.h> | | 37 | #include <err.h> |
38 | #include <errno.h> | | 38 | #include <errno.h> |
39 | #include <fcntl.h> | | 39 | #include <fcntl.h> |
40 | #include <limits.h> | | 40 | #include <limits.h> |
41 | #include <paths.h> | | 41 | #include <paths.h> |
42 | #include <sched.h> | | 42 | #include <sched.h> |
43 | #include <stdint.h> | | 43 | #include <stdint.h> |
| @@ -157,27 +157,27 @@ intrctl_list(int argc, char **argv) | | | @@ -157,27 +157,27 @@ intrctl_list(int argc, char **argv) |
157 | int len; | | 157 | int len; |
158 | snprintf(buf, sizeof(buf), "%" PRIu64, | | 158 | snprintf(buf, sizeof(buf), "%" PRIu64, |
159 | illine->ill_cpu[i].illc_count); | | 159 | illine->ill_cpu[i].illc_count); |
160 | len = (int)strlen(buf); | | 160 | len = (int)strlen(buf); |
161 | if (cpucol[i] < len) | | 161 | if (cpucol[i] < len) |
162 | cpucol[i] = len; | | 162 | cpucol[i] = len; |
163 | } | | 163 | } |
164 | } | | 164 | } |
165 | | | 165 | |
166 | /* header */ | | 166 | /* header */ |
167 | printf("%-*s", (int)intridlen, "interrupt id"); | | 167 | printf("%-*s", (int)intridlen, "interrupt id"); |
168 | if (compact) { | | 168 | if (compact) { |
169 | printf(" %20s ", "total"); | | 169 | printf(" %20s ", "total"); |
170 | printf(" %20s ", "affinity"); | | 170 | printf(" %5s ", "aff"); |
171 | } else { | | 171 | } else { |
172 | for (i = 0; i < ncpus; i++) { | | 172 | for (i = 0; i < ncpus; i++) { |
173 | snprintf(buf, sizeof(buf), "CPU%u", i); | | 173 | snprintf(buf, sizeof(buf), "CPU%u", i); |
174 | printf("%*s ", cpucol[i], buf); | | 174 | printf("%*s ", cpucol[i], buf); |
175 | } | | 175 | } |
176 | } | | 176 | } |
177 | printf("device name(s)\n"); | | 177 | printf("device name(s)\n"); |
178 | | | 178 | |
179 | /* body */ | | 179 | /* body */ |
180 | for (illine = intrctl_io_firstline(handle); illine != NULL; | | 180 | for (illine = intrctl_io_firstline(handle); illine != NULL; |
181 | illine = intrctl_io_nextline(handle, illine)) { | | 181 | illine = intrctl_io_nextline(handle, illine)) { |
182 | struct intrio_list_line_cpu *illc; | | 182 | struct intrio_list_line_cpu *illc; |
183 | | | 183 | |
| @@ -189,27 +189,27 @@ intrctl_list(int argc, char **argv) | | | @@ -189,27 +189,27 @@ intrctl_list(int argc, char **argv) |
189 | illc = &illine->ill_cpu[i]; | | 189 | illc = &illine->ill_cpu[i]; |
190 | total += illc->illc_count; | | 190 | total += illc->illc_count; |
191 | if (illc->illc_assigned) { | | 191 | if (illc->illc_assigned) { |
192 | asprintf(&affinity, "%s%s%d", | | 192 | asprintf(&affinity, "%s%s%d", |
193 | oaffinity ? oaffinity : "", | | 193 | oaffinity ? oaffinity : "", |
194 | oaffinity ? ", " : "", | | 194 | oaffinity ? ", " : "", |
195 | i); | | 195 | i); |
196 | if (oaffinity) | | 196 | if (oaffinity) |
197 | free(oaffinity); | | 197 | free(oaffinity); |
198 | oaffinity = affinity; | | 198 | oaffinity = affinity; |
199 | } | | 199 | } |
200 | } | | 200 | } |
201 | printf("%20" PRIu64 " ", total); | | 201 | printf("%20" PRIu64 " ", total); |
202 | printf("%20s ", affinity ? affinity : "none"); | | 202 | printf("%5s ", affinity ? affinity : "none"); |
203 | free(affinity); | | 203 | free(affinity); |
204 | } else { | | 204 | } else { |
205 | for (i = 0; i < ncpus; i++) { | | 205 | for (i = 0; i < ncpus; i++) { |
206 | illc = &illine->ill_cpu[i]; | | 206 | illc = &illine->ill_cpu[i]; |
207 | printf("%*" PRIu64 "%c ", cpucol[i], illc->illc_count, | | 207 | printf("%*" PRIu64 "%c ", cpucol[i], illc->illc_count, |
208 | illc->illc_assigned ? '*' : ' '); | | 208 | illc->illc_assigned ? '*' : ' '); |
209 | } | | 209 | } |
210 | } | | 210 | } |
211 | printf("%s\n", illine->ill_xname); | | 211 | printf("%s\n", illine->ill_xname); |
212 | } | | 212 | } |
213 | | | 213 | |
214 | free(cpucol); | | 214 | free(cpucol); |
215 | intrctl_io_free(handle); | | 215 | intrctl_io_free(handle); |