diff options
author | Thomas Graf <tgraf@suug.ch> | 2010-11-17 10:55:42 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2010-11-17 10:55:42 (GMT) |
commit | 10424b20c1f29175fce07d0bf7639f2cc324ad78 (patch) | |
tree | 6e87adbac88895480837a84ef197919e89c8e605 /lib/utils.c | |
parent | 3a9562001c91a8b876b8ff8e26bafc9f86fbad23 (diff) | |
download | libnl-10424b20c1f29175fce07d0bf7639f2cc324ad78.zip libnl-10424b20c1f29175fce07d0bf7639f2cc324ad78.tar.gz libnl-10424b20c1f29175fce07d0bf7639f2cc324ad78.tar.bz2 |
Rename nl_get_hz() to nl_get_user_hz() to indicate it's not the in-kernel HZ value
Diffstat (limited to 'lib/utils.c')
-rw-r--r-- | lib/utils.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/utils.c b/lib/utils.c index 56a92bf..1168293 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -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; } |