*/
#define RAMBLOCK_INFO_MAX_LEN 256
+/*
+ * Minimum RAMBlock size to sample, in megabytes.
+ */
+#define MIN_RAMBLOCK_SIZE 128
+
+/*
+ * Take 1s as minimum time for calculation duration
+ */
+#define MIN_FETCH_DIRTYRATE_TIME_SEC 1
+#define MAX_FETCH_DIRTYRATE_TIME_SEC 60
+
struct DirtyRateConfig {
uint64_t sample_pages_per_gigabytes; /* sample pages per GB */
int64_t sample_period_seconds; /* time duration between two sampling */
uint32_t *hash_result; /* array of hash result for sampled pages */
};
+/*
+ * Store calculation statistics for each measure.
+ */
+struct DirtyRateStat {
+ uint64_t total_dirty_samples; /* total dirty sampled page */
+ uint64_t total_sample_count; /* total sampled pages */
+ uint64_t total_block_mem_MB; /* size of total sampled pages in MB */
+ int64_t dirty_rate; /* dirty rate in MB/s */
+ int64_t start_time; /* calculation start time in units of second */
+ int64_t calc_time; /* time duration of two sampling in units of second */
+};
+
void *get_dirtyrate_thread(void *arg);
#endif