mirror of
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git
synced 2024-11-16 14:35:34 +08:00
Add sprint_ticks() function and use in CBQ
[IPROUTE]: Add sprint_ticks() function and use in CBQ Add helper function to print ticks to avoid assumptions about clock resolution in CBQ. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
This commit is contained in:
parent
8f34caafbd
commit
bd29e35d9d
@ -418,6 +418,7 @@ static int cbq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
|||||||
struct tc_cbq_wrropt *wrr = NULL;
|
struct tc_cbq_wrropt *wrr = NULL;
|
||||||
struct tc_cbq_fopt *fopt = NULL;
|
struct tc_cbq_fopt *fopt = NULL;
|
||||||
struct tc_cbq_ovl *ovl = NULL;
|
struct tc_cbq_ovl *ovl = NULL;
|
||||||
|
SPRINT_BUF(b1);
|
||||||
|
|
||||||
if (opt == NULL)
|
if (opt == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
@ -500,17 +501,17 @@ static int cbq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
|||||||
if (lss && show_details) {
|
if (lss && show_details) {
|
||||||
fprintf(f, "\nlevel %u ewma %u avpkt %ub ", lss->level, lss->ewma_log, lss->avpkt);
|
fprintf(f, "\nlevel %u ewma %u avpkt %ub ", lss->level, lss->ewma_log, lss->avpkt);
|
||||||
if (lss->maxidle) {
|
if (lss->maxidle) {
|
||||||
fprintf(f, "maxidle %luus ", tc_core_tick2time(lss->maxidle>>lss->ewma_log));
|
fprintf(f, "maxidle %s ", sprint_ticks(lss->maxidle>>lss->ewma_log, b1));
|
||||||
if (show_raw)
|
if (show_raw)
|
||||||
fprintf(f, "[%08x] ", lss->maxidle);
|
fprintf(f, "[%08x] ", lss->maxidle);
|
||||||
}
|
}
|
||||||
if (lss->minidle!=0x7fffffff) {
|
if (lss->minidle!=0x7fffffff) {
|
||||||
fprintf(f, "minidle %luus ", tc_core_tick2time(lss->minidle>>lss->ewma_log));
|
fprintf(f, "minidle %s ", sprint_ticks(lss->minidle>>lss->ewma_log, b1));
|
||||||
if (show_raw)
|
if (show_raw)
|
||||||
fprintf(f, "[%08x] ", lss->minidle);
|
fprintf(f, "[%08x] ", lss->minidle);
|
||||||
}
|
}
|
||||||
if (lss->offtime) {
|
if (lss->offtime) {
|
||||||
fprintf(f, "offtime %luus ", tc_core_tick2time(lss->offtime));
|
fprintf(f, "offtime %s ", sprint_ticks(lss->offtime, b1));
|
||||||
if (show_raw)
|
if (show_raw)
|
||||||
fprintf(f, "[%08x] ", lss->offtime);
|
fprintf(f, "[%08x] ", lss->offtime);
|
||||||
}
|
}
|
||||||
|
@ -120,12 +120,6 @@ static int get_ticks(__u32 *ticks, const char *str)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *sprint_ticks(__u32 ticks, char *buf)
|
|
||||||
{
|
|
||||||
return sprint_usecs(tc_core_tick2usec(ticks), buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
||||||
struct nlmsghdr *n)
|
struct nlmsghdr *n)
|
||||||
{
|
{
|
||||||
|
@ -255,6 +255,11 @@ char * sprint_time(__u32 time, char *buf)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char * sprint_ticks(__u32 ticks, char *buf)
|
||||||
|
{
|
||||||
|
return sprint_time(tc_core_tick2time(ticks), buf);
|
||||||
|
}
|
||||||
|
|
||||||
int get_size(unsigned *size, const char *str)
|
int get_size(unsigned *size, const char *str)
|
||||||
{
|
{
|
||||||
double sz;
|
double sz;
|
||||||
|
@ -57,6 +57,7 @@ extern char * sprint_size(__u32 size, char *buf);
|
|||||||
extern char * sprint_qdisc_handle(__u32 h, char *buf);
|
extern char * sprint_qdisc_handle(__u32 h, char *buf);
|
||||||
extern char * sprint_tc_classid(__u32 h, char *buf);
|
extern char * sprint_tc_classid(__u32 h, char *buf);
|
||||||
extern char * sprint_time(__u32 time, char *buf);
|
extern char * sprint_time(__u32 time, char *buf);
|
||||||
|
extern char * sprint_ticks(__u32 ticks, char *buf);
|
||||||
extern char * sprint_percent(__u32 percent, char *buf);
|
extern char * sprint_percent(__u32 percent, char *buf);
|
||||||
|
|
||||||
extern void print_tcstats_attr(FILE *fp, struct rtattr *tb[], char *prefix, struct rtattr **xstats);
|
extern void print_tcstats_attr(FILE *fp, struct rtattr *tb[], char *prefix, struct rtattr **xstats);
|
||||||
|
Loading…
Reference in New Issue
Block a user