当前位置:网站首页>counting cycle
counting cycle
2022-08-04 06:34:00 【xcy6666】
.section .data
cycle_str:
.asciz "cycle count is: %lu\n"
long:
.quad 5
.section .text
.globl _start
_start:
# measure base = mov + rdtsc
xorq %rax, %rax
rdtsc # write time stamp to rax
movq %rax, %rcx # %rcx = %rax
rdtsc # write time stamp to rax
subq %rcx, %rax # %rax = %rax -%rcx
movq %rax, %rsi
movq $cycle_str, %rdi
movq $0, %rax
call printf
# measure base + xchgq
xorq %rax, %rax
rdtsc # write time stamp to rax
movq %rax, %rcx # %rcx = %rax
xchgq long, %rdx
rdtsc # write time stamp to rax
subq %rcx, %rax # %rax = %rax -%rcx
# print %rax
movq %rax, %rsi
movq $cycle_str, %rdi
movq $0, %rax
call printf
# exit
movq $1,%rax # syscall id: sys_exit
movq $0,%rbx # exit code 0
int $0x80
all:
as -o hello.o hello.S
ld -o hello hello.o -lc --dynamic-linker /lib64/ld-linux-x86-64.so.2
./hello
clean:
rm *.o hello
https://docs.microsoft.com/en-us/cpp/intrinsics/rdtsc?view=msvc-160
https://cs.brown.edu/courses/cs033/docs/guides/x64_cheatsheet.pdf
https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/ia-32-ia-64-benchmark-code-execution-paper.pdf
边栏推荐
- FAREWARE ADDRESS
- The second official example analysis of the MOOSE platform - about creating a Kernel and solving the convection-diffusion equation
- 基于语音识别的QT设计的csgo互动类视频游戏
- 安装MySQL的详细步骤
- CSDN大礼包--高校圆桌派大礼包
- Golang环境变量设置(二)--GOMODULE&GOPROXY
- [daily office][ssh]cheatsheet
- C语言结构体(必须掌握版)
- LeetCode_Nov_3rd_Week
- MNIST handwritten digit recognition, sorted by from two to ten
猜你喜欢

安装Apache服务时出现的几个问题, AH00369,AH00526,AH00072....

Deep Learning Theory - Initialization, Parameter Adjustment

Amazon Cloud Technology Build On 2022 - AIot Season 2 IoT Special Experiment Experience

AWS使用EC2降低DeepRacer的训练成本:DeepRacer-for-cloud的实践操作

使用JS在浏览器中打印菱形

树和二叉树

最全的最详细的指针讲解(C语言)

安装MySQL的详细步骤

管道重定向

Design and implementation of legal aid platform based on asp.net (with project link)
随机推荐
在AWS-EC2中安装Minikube集群
SFTP的用法
[English learning][sentence] good sentence
第三章 标准单元库(下)
第三章 标准单元库(上)
Pipe redirection
Deep learning, "grain and grass" first--On the way to obtain data sets
Usage of SFTP
EL表达式
makefile基础学习
LeetCode_Nov_5th_Week
第二章 STA相关概念
Amazon Cloud Technology Build On-Amazon Neptune's Knowledge Graph-Based Recommendation Model Building Experience
Shell基础
LeetCode_Nov_3rd_Week
结构体传参-C语言
C语言数组的深度分析
Golang environment variable settings (2)--GOMODULE & GOPROXY
淘宝分布式文件系统存储(二)
IDEA中创建web项目实现步骤