Rename nl_get_hz() to nl_get_user_hz() to indicate it's not the in-kernel HZ value

This commit is contained in:
Thomas Graf 2010-11-17 11:55:42 +01:00
parent 3a9562001c
commit 10424b20c1
5 changed files with 14 additions and 10 deletions

View file

@ -48,7 +48,7 @@ extern long nl_size2int(const char *);
extern long nl_prob2int(const char *);
/* time translations */
extern int nl_get_hz(void);
extern int nl_get_user_hz(void);
extern uint32_t nl_us2ticks(uint32_t);
extern uint32_t nl_ticks2us(uint32_t);
extern int nl_str2msec(const char *, uint64_t *);

View file

@ -367,7 +367,7 @@ static void neigh_dump_details(struct nl_object *a, struct nl_dump_params *p)
{
char rtn_type[32];
struct rtnl_neigh *n = (struct rtnl_neigh *) a;
int hz = nl_get_hz();
int hz = nl_get_user_hz();
neigh_dump_line(a, p);

View file

@ -284,8 +284,8 @@ static void route_dump_stats(struct nl_object *obj, struct nl_dump_params *p)
nl_dump_line(p, " used %u refcnt %u last-use %us "
"expires %us\n",
ci->rtci_used, ci->rtci_clntref,
ci->rtci_last_use / nl_get_hz(),
ci->rtci_expires / nl_get_hz());
ci->rtci_last_use / nl_get_user_hz(),
ci->rtci_expires / nl_get_user_hz());
}
}

View file

@ -284,14 +284,14 @@ static struct nl_msg *htb_class_get_opts(struct rtnl_class *class)
if (d->ch_mask & SCH_HTB_HAS_RBUFFER)
buffer = d->ch_rbuffer;
else
buffer = opts.rate.rate / nl_get_hz() + mtu;
buffer = opts.rate.rate / nl_get_user_hz() + mtu; /* XXX */
opts.buffer = rtnl_tc_calc_txtime(buffer, opts.rate.rate);
if (d->ch_mask & SCH_HTB_HAS_CBUFFER)
cbuffer = d->ch_cbuffer;
else
cbuffer = opts.ceil.rate / nl_get_hz() + mtu;
cbuffer = opts.ceil.rate / nl_get_user_hz() + mtu; /* XXX */
opts.cbuffer = rtnl_tc_calc_txtime(cbuffer, opts.ceil.rate);

View file

@ -313,11 +313,15 @@ static void __init get_psched_settings(void)
strncpy(name, "/proc/net/psched", sizeof(name) - 1);
if ((fd = fopen(name, "r"))) {
uint32_t tick, us;
uint32_t ns_per_usec, ns_per_tick;
/* the file contains 4 hexadecimals, but we just use
the first two of them */
fscanf(fd, "%08x %08x", &tick, &us);
ticks_per_usec = (double)tick/(double)us;
fscanf(fd, "%08x %08x", &ns_per_usec, &ns_per_tick);
ticks_per_usec = (double) ns_per_usec /
(double) ns_per_tick;
fclose(fd);
}
}
@ -327,7 +331,7 @@ static void __init get_psched_settings(void)
/**
* Return the value of HZ
*/
int nl_get_hz(void)
int nl_get_user_hz(void)
{
return user_hz;
}