1 Star 0 Fork 23

yueguofeng/perftest

forked from src-openEuler/perftest 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0007-add-loongarch-support-for-perftest.patch 908 Bytes
一键复制 编辑 原始数据 按行查看 历史
zhangwenlong01 提交于 2023-01-07 11:29 . fix build error for loongarch64
From 9600d3bae7e8f116aff303df7e13f23e67274096 Mon Sep 17 00:00:00 2001
From: Wenlong Zhang <zhangwenlong@loongson.cn>
Date: Sat, 7 Jan 2023 03:23:20 +0000
Subject: [PATCH] add loongarch support for perftest
add function get_cycles for loongarch64
Signed-off-by: Wenlong Zhang <zhangwenlong@loongson.cn>
---
src/get_clock.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/get_clock.h b/src/get_clock.h
index dacbcd0..5b7b48b 100755
--- a/src/get_clock.h
+++ b/src/get_clock.h
@@ -105,6 +105,15 @@ static inline cycles_t get_cycles()
return cval;
}
+#elif defined(__loongarch64)
+typedef unsigned long cycles_t;
+static inline cycles_t get_cycles()
+{
+ cycles_t count;
+ asm volatile("rdtime.d %0, $zero" : "=r" (count));
+ return count;
+}
+
#else
#warning get_cycles not implemented for this architecture: attempt asm/timex.h
#include <asm/timex.h>
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ygf_123/perftest.git
git@gitee.com:ygf_123/perftest.git
ygf_123
perftest
perftest
master

搜索帮助