Merge pull request #764 from mmkayPL/false_stats
Change method for calculating 'dirty_for' statistic
This commit is contained in:
commit
7a3b248c35
@ -70,11 +70,11 @@ static float calc_gb(uint64_t clines)
|
||||
return (float) clines * 4 * KiB / GiB;
|
||||
}
|
||||
|
||||
static void print_dirty_for_time(uint32_t t, FILE *outfile)
|
||||
static void print_dirty_for_time(uint64_t t, FILE *outfile)
|
||||
{
|
||||
uint32_t d, h, m, s;
|
||||
|
||||
fprintf(outfile, "%u,[s],", t);
|
||||
fprintf(outfile, "%lu,[s],", t);
|
||||
|
||||
if (!t) {
|
||||
fprintf(outfile, "Cache clean");
|
||||
@ -112,7 +112,7 @@ static void print_kv_pair(FILE *outfile, const char *title, const char *fmt, ...
|
||||
fprintf(outfile, "\n");
|
||||
}
|
||||
|
||||
static void print_kv_pair_time(FILE *outfile, const char *title, uint32_t time)
|
||||
static void print_kv_pair_time(FILE *outfile, const char *title, uint64_t time)
|
||||
{
|
||||
fprintf(outfile, TAG(KV_PAIR) "\"%s\",", title);
|
||||
print_dirty_for_time(time, outfile);
|
||||
|
31
configure.d/1_timekeeping.conf
Normal file
31
configure.d/1_timekeeping.conf
Normal file
@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
. $(dirname $3)/conf_framework
|
||||
|
||||
check() {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
if compile_module $cur_name "ktime_get_real_ts64(NULL)" "linux/ktime.h"
|
||||
then
|
||||
echo $cur_name "1" >> $config_file_path
|
||||
else
|
||||
echo $cur_name "2" >> $config_file_path
|
||||
fi
|
||||
}
|
||||
|
||||
apply() {
|
||||
case "$1" in
|
||||
"1")
|
||||
add_define "CAS_GET_CURRENT_TIME(timespec) ktime_get_real_ts64(timespec)" ;;
|
||||
"2")
|
||||
add_define "CAS_GET_CURRENT_TIME(timespec) getnstimeofday(timespec)" ;;
|
||||
*)
|
||||
exit 1
|
||||
esac
|
||||
}
|
||||
|
||||
conf_run $@
|
@ -39,6 +39,7 @@
|
||||
#include <linux/ratelimit.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/blk-mq.h>
|
||||
#include <linux/ktime.h>
|
||||
|
||||
#include "generated_defines.h"
|
||||
|
||||
|
@ -533,23 +533,40 @@ static inline void env_cond_resched(void)
|
||||
|
||||
static inline int env_in_interrupt(void)
|
||||
{
|
||||
return in_interrupt();;
|
||||
return in_interrupt();
|
||||
}
|
||||
|
||||
/* *** TIME *** */
|
||||
static inline uint64_t env_get_tick_count(void)
|
||||
{
|
||||
return jiffies;
|
||||
}
|
||||
|
||||
static inline uint64_t env_ticks_to_msecs(uint64_t j)
|
||||
{
|
||||
return jiffies_to_msecs(j);
|
||||
struct timespec64 ts;
|
||||
CAS_GET_CURRENT_TIME(&ts);
|
||||
return ts.tv_sec * 1000000000UL + ts.tv_nsec;
|
||||
}
|
||||
|
||||
static inline uint64_t env_ticks_to_nsecs(uint64_t j)
|
||||
{
|
||||
return jiffies_to_usecs(j) * NSEC_PER_USEC;
|
||||
return j;
|
||||
}
|
||||
|
||||
static inline uint64_t env_ticks_to_usecs(uint64_t j)
|
||||
{
|
||||
return j / 1000UL;
|
||||
}
|
||||
|
||||
static inline uint64_t env_ticks_to_msecs(uint64_t j)
|
||||
{
|
||||
return j / 1000000UL;
|
||||
}
|
||||
|
||||
static inline uint64_t env_ticks_to_secs(uint64_t j)
|
||||
{
|
||||
return j / 1000000000UL;
|
||||
}
|
||||
|
||||
static inline uint64_t env_secs_to_ticks(uint64_t j)
|
||||
{
|
||||
return j * 1000000000UL;
|
||||
}
|
||||
|
||||
static inline bool env_time_after(uint64_t a, uint64_t b)
|
||||
@ -557,14 +574,9 @@ static inline bool env_time_after(uint64_t a, uint64_t b)
|
||||
return time_after64(a,b);
|
||||
}
|
||||
|
||||
static inline uint64_t env_ticks_to_secs(uint64_t j)
|
||||
static inline void env_msleep(uint64_t n)
|
||||
{
|
||||
return j >> SHIFT_HZ;
|
||||
}
|
||||
|
||||
static inline uint64_t env_secs_to_ticks(uint64_t j)
|
||||
{
|
||||
return j << SHIFT_HZ;
|
||||
msleep(n);
|
||||
}
|
||||
|
||||
/* *** BIT OPERATIONS *** */
|
||||
@ -584,11 +596,6 @@ static inline int env_bit_test(int nr, const void *addr)
|
||||
return test_bit(nr, addr);
|
||||
}
|
||||
|
||||
static inline void env_msleep(uint64_t n)
|
||||
{
|
||||
msleep(n);
|
||||
}
|
||||
|
||||
/* *** STRING OPERATIONS *** */
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user