Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
932a086e
Commit
932a086e
authored
May 29, 2017
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vmstat, better handling of irq counters, for
https://github.com/opnsense/core/issues/1662
parent
f15eb3b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
11 deletions
+28
-11
list_interrupts.py
src/opnsense/scripts/system/list_interrupts.py
+6
-2
status_interfaces.php
src/www/status_interfaces.php
+22
-9
No files found.
src/opnsense/scripts/system/list_interrupts.py
View file @
932a086e
...
...
@@ -40,18 +40,22 @@ if __name__ == '__main__':
subprocess
.
call
([
'/usr/bin/vmstat'
,
'-i'
],
stdout
=
output_stream
,
stderr
=
open
(
os
.
devnull
,
'wb'
))
output_stream
.
seek
(
0
)
data
=
output_stream
.
read
()
.
strip
()
intf
=
None
interrupts
=
dict
()
interrupt_map
=
dict
()
for
line
in
data
.
split
(
'
\n
'
):
if
line
.
find
(
':'
)
>
-
1
:
intrp
=
line
.
split
(
':'
)[
0
]
.
strip
()
parts
=
line
.
split
(
':'
)[
1
]
.
split
()
parts
=
':'
.
join
(
line
.
split
(
':'
)[
1
:])
.
split
()
interrupts
[
intrp
]
=
{
'devices'
:
[],
'total'
:
None
,
'rate'
:
None
}
for
part
in
parts
:
if
not
part
.
isdigit
():
interrupts
[
intrp
][
'devices'
]
.
append
(
part
)
interrupt_map
[
part
]
=
intrp
devnm
=
part
.
split
(
':'
)[
0
]
if
devnm
not
in
interrupt_map
:
interrupt_map
[
devnm
]
=
list
()
interrupt_map
[
devnm
]
.
append
(
intrp
)
elif
interrupts
[
intrp
][
'total'
]
is
None
:
interrupts
[
intrp
][
'total'
]
=
int
(
part
)
else
:
...
...
src/www/status_interfaces.php
View file @
932a086e
...
...
@@ -438,17 +438,30 @@ include("head.inc");
<?php
endif
;
if
(
!
empty
(
$vmstat_interupts
[
'interrupt_map'
][
$ifinfo
[
'if'
]]))
:
$intrpt
=
$vmstat_interupts
[
'interrupt_map'
][
$ifinfo
[
'if'
]];
$interrupt_total
=
$vmstat_interupts
[
'interrupts'
][
$intrpt
][
'total'
];
$interrupt_rate
=
$vmstat_interupts
[
'interrupts'
][
$intrpt
][
'rate'
];
?>
$intrpts
=
$vmstat_interupts
[
'interrupt_map'
][
$ifinfo
[
'if'
]];
?>
<tr>
<td>
<?=
gettext
(
"Interrupts
per Second
"
)
?>
</td>
<td>
<?=
gettext
(
"Interrupts"
)
?>
</td>
<td>
<?php
printf
(
gettext
(
"%s total"
),
$interrupt_total
);
echo
"<br />"
;
printf
(
gettext
(
"%s rate"
),
$interrupt_rate
);
?>
<table
class=
"table"
>
<thead>
<tr>
<th>
<?=
gettext
(
"irq"
);
?>
</th>
<th>
<?=
gettext
(
"device"
);
?>
</th>
<th>
<?=
gettext
(
"total"
);
?>
</th>
<th>
<?=
gettext
(
"rate"
);
?>
</th>
</tr>
</thead>
<?php
foreach
(
$intrpts
as
$intrpt
)
:?>
<
tr
>
<
td
><?=
$intrpt
;
?>
</td>
<td>
<?=
implode
(
' '
,
$vmstat_interupts
[
'interrupts'
][
$intrpt
][
'devices'
]);
?>
</td>
<td>
<?=
$vmstat_interupts
[
'interrupts'
][
$intrpt
][
'total'
];
?>
</td>
<td>
<?=
$vmstat_interupts
[
'interrupts'
][
$intrpt
][
'rate'
];
?>
</td>
</tr>
<?php
endforeach
;
?>
</table>
</td>
</tr>
<?php
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment