Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
mirrors
openwrt
luci
提交
bdf64340
L
luci
项目概览
mirrors
/
openwrt
/
luci
大约 1 年 前同步成功
通知
43
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
luci
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bdf64340
编写于
10月 28, 2011
作者:
J
Jo-Philipp Wich
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
luci-0.10: merge r7811
上级
eda5b4be
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
48 deletion
+33
-48
modules/admin-full/src/luci-bwc.c
modules/admin-full/src/luci-bwc.c
+33
-48
未找到文件。
modules/admin-full/src/luci-bwc.c
浏览文件 @
bdf64340
...
...
@@ -33,7 +33,6 @@
#include <dlfcn.h>
#define STEP_COUNT 60
#define STEP_TIME 1
#define TIMEOUT 10
...
...
@@ -47,9 +46,9 @@
#define DB_LD_FILE DB_PATH "/load"
#define IF_SCAN_PATTERN \
" %[^ :]:%
" SCNu64 " %" SCNu64
\
" %[^ :]:%
u %u"
\
" %*d %*d %*d %*d %*d %*d" \
" %
" SCNu64 " %" SCNu64
" %
u %u"
#define LD_SCAN_PATTERN \
"%f %f %f"
...
...
@@ -62,48 +61,34 @@ struct file_map {
};
struct
traffic_entry
{
uint
64
_t
time
;
uint
64
_t
rxb
;
uint
64
_t
rxp
;
uint
64
_t
txb
;
uint
64
_t
txp
;
uint
32
_t
time
;
uint
32
_t
rxb
;
uint
32
_t
rxp
;
uint
32
_t
txb
;
uint
32
_t
txp
;
};
struct
conn_entry
{
uint
64
_t
time
;
uint
32
_t
time
;
uint32_t
udp
;
uint32_t
tcp
;
uint32_t
other
;
};
struct
load_entry
{
uint
64
_t
time
;
uint
32
_t
time
;
uint16_t
load1
;
uint16_t
load5
;
uint16_t
load15
;
};
struct
radio_entry
{
uint
64
_t
time
;
uint
32
_t
time
;
uint16_t
rate
;
uint8_t
rssi
;
uint8_t
noise
;
};
static
uint64_t
htonll
(
uint64_t
value
)
{
int
num
=
1
;
if
(
*
(
char
*
)
&
num
==
1
)
return
htonl
((
uint32_t
)(
value
&
0xFFFFFFFF
))
|
htonl
((
uint32_t
)(
value
>>
32
));
return
value
;
}
#define ntohll htonll
static
int
readpid
(
void
)
{
int
fd
;
...
...
@@ -204,9 +189,9 @@ static int init_file(char *path, int esize)
return
-
1
;
}
static
inline
uint
64
_t
timeof
(
void
*
entry
)
static
inline
uint
32
_t
timeof
(
void
*
entry
)
{
return
((
struct
traffic_entry
*
)
entry
)
->
time
;
return
ntohl
(((
struct
traffic_entry
*
)
entry
)
->
time
)
;
}
static
int
update_file
(
const
char
*
path
,
void
*
entry
,
int
esize
)
...
...
@@ -326,7 +311,7 @@ static void iwinfo_close(void *iw)
static
int
update_ifstat
(
const
char
*
ifname
,
uint
64_t
rxb
,
uint64_t
rxp
,
uint64_t
txb
,
uint64
_t
txp
const
char
*
ifname
,
uint
32_t
rxb
,
uint32_t
rxp
,
uint32_t
txb
,
uint32
_t
txp
)
{
char
path
[
1024
];
...
...
@@ -346,11 +331,11 @@ static int update_ifstat(
}
}
e
.
time
=
htonl
l
(
time
(
NULL
));
e
.
rxb
=
htonl
l
(
rxb
);
e
.
rxp
=
htonl
l
(
rxp
);
e
.
txb
=
htonl
l
(
txb
);
e
.
txp
=
htonl
l
(
txp
);
e
.
time
=
htonl
(
time
(
NULL
));
e
.
rxb
=
htonl
(
rxb
);
e
.
rxp
=
htonl
(
rxp
);
e
.
txb
=
htonl
(
txb
);
e
.
txp
=
htonl
(
txp
);
return
update_file
(
path
,
&
e
,
sizeof
(
struct
traffic_entry
));
}
...
...
@@ -376,7 +361,7 @@ static int update_radiostat(
}
}
e
.
time
=
htonl
l
(
time
(
NULL
));
e
.
time
=
htonl
(
time
(
NULL
));
e
.
rate
=
htons
(
rate
);
e
.
rssi
=
rssi
;
e
.
noise
=
noise
;
...
...
@@ -404,7 +389,7 @@ static int update_cnstat(uint32_t udp, uint32_t tcp, uint32_t other)
}
}
e
.
time
=
htonl
l
(
time
(
NULL
));
e
.
time
=
htonl
(
time
(
NULL
));
e
.
udp
=
htonl
(
udp
);
e
.
tcp
=
htonl
(
tcp
);
e
.
other
=
htonl
(
other
);
...
...
@@ -432,7 +417,7 @@ static int update_ldstat(uint16_t load1, uint16_t load5, uint16_t load15)
}
}
e
.
time
=
htonl
l
(
time
(
NULL
));
e
.
time
=
htonl
(
time
(
NULL
));
e
.
load1
=
htons
(
load1
);
e
.
load5
=
htons
(
load5
);
e
.
load15
=
htons
(
load15
);
...
...
@@ -443,7 +428,7 @@ static int update_ldstat(uint16_t load1, uint16_t load5, uint16_t load15)
static
int
run_daemon
(
void
)
{
FILE
*
info
;
uint
64
_t
rxb
,
txb
,
rxp
,
txp
;
uint
32
_t
rxb
,
txb
,
rxp
,
txp
;
uint32_t
udp
,
tcp
,
other
;
uint16_t
rate
;
uint8_t
rssi
,
noise
;
...
...
@@ -636,11 +621,11 @@ static int run_dump_ifname(const char *ifname)
if
(
!
e
->
time
)
continue
;
printf
(
"[ %
"
PRIu64
", %"
PRIu64
", %"
PRIu64
", %
"
PRIu64
", %"
PRIu64
"
]%s
\n
"
,
ntohl
l
(
e
->
time
),
ntohl
l
(
e
->
rxb
),
ntohl
l
(
e
->
rxp
),
ntohl
l
(
e
->
txb
),
ntohl
l
(
e
->
txp
),
printf
(
"[ %
u, %u, %"
PRIu32
", %
u, %u
]%s
\n
"
,
ntohl
(
e
->
time
),
ntohl
(
e
->
rxb
),
ntoh
l
(
e
->
rxp
),
ntohl
(
e
->
txb
),
ntoh
l
(
e
->
txp
),
((
i
+
sizeof
(
struct
traffic_entry
))
<
m
.
size
)
?
","
:
""
);
}
...
...
@@ -672,8 +657,8 @@ static int run_dump_radio(const char *ifname)
if
(
!
e
->
time
)
continue
;
printf
(
"[ %
"
PRIu64
"
, %d, %d, %d ]%s
\n
"
,
ntohl
l
(
e
->
time
),
printf
(
"[ %
u
, %d, %d, %d ]%s
\n
"
,
ntohl
(
e
->
time
),
e
->
rate
,
e
->
rssi
,
e
->
noise
,
((
i
+
sizeof
(
struct
radio_entry
))
<
m
.
size
)
?
","
:
""
);
}
...
...
@@ -706,8 +691,8 @@ static int run_dump_conns(void)
if
(
!
e
->
time
)
continue
;
printf
(
"[ %
"
PRIu64
"
, %u, %u, %u ]%s
\n
"
,
ntohl
l
(
e
->
time
),
ntohl
(
e
->
udp
),
printf
(
"[ %
u
, %u, %u, %u ]%s
\n
"
,
ntohl
(
e
->
time
),
ntohl
(
e
->
udp
),
ntohl
(
e
->
tcp
),
ntohl
(
e
->
other
),
((
i
+
sizeof
(
struct
conn_entry
))
<
m
.
size
)
?
","
:
""
);
}
...
...
@@ -740,8 +725,8 @@ static int run_dump_load(void)
if
(
!
e
->
time
)
continue
;
printf
(
"[ %
"
PRIu64
"
, %u, %u, %u ]%s
\n
"
,
ntohl
l
(
e
->
time
),
printf
(
"[ %
u
, %u, %u, %u ]%s
\n
"
,
ntohl
(
e
->
time
),
ntohs
(
e
->
load1
),
ntohs
(
e
->
load5
),
ntohs
(
e
->
load15
),
((
i
+
sizeof
(
struct
load_entry
))
<
m
.
size
)
?
","
:
""
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录