加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0010-blkparse-split-off-the-timestamp-correction-code-in-.patch 1.90 KB
一键复制 编辑 原始数据 按行查看 历史
From 28c81fa538418628addf8b18cbed8ba5c62f3cc8 Mon Sep 17 00:00:00 2001
From: Hiroaki Mihara <hmihara@redhat.com>
Date: Wed, 25 Sep 2019 07:32:06 +0900
Subject: [PATCH 10/15] blkparse: split off the timestamp correction code in to
a separate function
find_genesis() function has code to correct abs_start_time, which is
later used to calculate the absolute timestamps of each traced
records.
Put this code in a separate function, so that it can be used later by
the blkparse code. No functional change.
Signed-off-by: Hiroaki Mihara <hmihara@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
blkparse.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/blkparse.c b/blkparse.c
index 227cc44..fb540ee 100644
--- a/blkparse.c
+++ b/blkparse.c
@@ -1920,6 +1920,22 @@ static void show_device_and_cpu_stats(void)
}
}
+static void correct_abs_start_time(void)
+{
+ long delta = genesis_time - start_timestamp;
+
+ abs_start_time.tv_sec += SECONDS(delta);
+ abs_start_time.tv_nsec += NANO_SECONDS(delta);
+ if (abs_start_time.tv_nsec < 0) {
+ abs_start_time.tv_nsec += 1000000000;
+ abs_start_time.tv_sec -= 1;
+ } else
+ if (abs_start_time.tv_nsec > 1000000000) {
+ abs_start_time.tv_nsec -= 1000000000;
+ abs_start_time.tv_sec += 1;
+ }
+}
+
static void find_genesis(void)
{
struct trace *t = trace_list;
@@ -1937,18 +1953,7 @@ static void find_genesis(void)
*/
if (start_timestamp
&& start_timestamp != genesis_time) {
- long delta = genesis_time - start_timestamp;
-
- abs_start_time.tv_sec += SECONDS(delta);
- abs_start_time.tv_nsec += NANO_SECONDS(delta);
- if (abs_start_time.tv_nsec < 0) {
- abs_start_time.tv_nsec += 1000000000;
- abs_start_time.tv_sec -= 1;
- } else
- if (abs_start_time.tv_nsec > 1000000000) {
- abs_start_time.tv_nsec -= 1000000000;
- abs_start_time.tv_sec += 1;
- }
+ correct_abs_start_time();
}
}
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化