Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
shop
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
曲欣亮
shop
Commits
0f74c095
Commit
0f74c095
authored
Aug 31, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
0d99514f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
Usage.java
src/main/java/com/egolm/shop/util/Usage.java
+7
-4
No files found.
src/main/java/com/egolm/shop/util/Usage.java
View file @
0f74c095
package
com
.
egolm
.
shop
.
util
;
package
com
.
egolm
.
collect
.
util
;
import
java.net.InetAddress
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -127,10 +126,10 @@ public class Usage {
CpuPerc
cpuList
[]
=
null
;
cpuList
=
sigar
.
getCpuPercList
();
for
(
int
i
=
0
;
i
<
infos
.
length
;
i
++)
{
// 不管是单块CPU还是多CPU都适用
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
map
=
new
Linked
HashMap
<
String
,
Object
>();
CpuInfo
info
=
infos
[
i
];
CpuPerc
cpu
=
cpuList
[
i
];
map
.
put
(
"
CUP
编号"
,
i
+
1
);
map
.
put
(
"编号"
,
i
+
1
);
map
.
put
(
"CPU的总量MHz"
,
info
.
getMhz
());
map
.
put
(
"CPU生产商"
,
info
.
getVendor
());
map
.
put
(
"CPU类别"
,
info
.
getModel
());
...
...
@@ -211,6 +210,10 @@ public class Usage {
String
name
=
ifNames
[
i
];
NetInterfaceConfig
ifconfig
=
sigar
.
getNetInterfaceConfig
(
name
);
NetInterfaceStat
ifstat
=
sigar
.
getNetInterfaceStat
(
name
);
String
ip
=
ifconfig
.
getAddress
();
if
(
"0.0.0.0"
.
equals
(
ip
))
{
continue
;
}
map
.
put
(
"网络设备名"
,
name
);
// 网络设备名
map
.
put
(
"IP地址"
,
ifconfig
.
getAddress
());
// IP地址
map
.
put
(
"子网掩码"
,
ifconfig
.
getNetmask
());
// 子网掩码
...
...
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