当前位置:网站首页>counting cycle
counting cycle
2022-08-04 05:30: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
边栏推荐
猜你喜欢

Brief description of database and common operation guide

深度学习理论 —— 初始化、参数调节

SQL注入详解

迅雷关闭自动更新

【论文阅读】Further Non-local and Channel Attention Networks for Vehicle Re-identification

lstm pipeline 过程理解(输入输出)

Deep Learning Theory - Initialization, Parameter Adjustment

打金?工作室?账号被封?游戏灰黑产离我们有多近

浅谈游戏音效测试点

Copy攻城狮5分钟在线体验 MindIR 格式模型生成
随机推荐
SQL注入详解
2020-10-29
Golang环境变量设置(二)--GOMODULE&GOPROXY
DRA821 环境搭建
How to grow into a senior engineer?
Copy Siege Lions "sticky" to AI couplets
光条中心提取方法总结(一)
MNIST手写数字识别 —— 基于Mindspore快速构建感知机实现十分类
LeetCode_Nov_2nd_Week
强化学习中,Q-Learning与Sarsa的差别有多大?
Android foundation [Super detailed android storage method analysis (SharedPreferences, SQLite database storage)]
Amazon Cloud Technology Build On-Amazon Neptune's Knowledge Graph-Based Recommendation Model Building Experience
lstm pipeline 过程理解(输入输出)
学习资料re-id
[Deep Learning Diary] Day 1: Hello world, Hello CNN MNIST
MFC 打开与保存点云PCD文件
sbl_init.asm-适合在编辑模式下看
图像resize
Deep Adversarial Decomposition: A Unified Framework for Separating Superimposed Images
A code example of the PCL method in the domain of DG (Domain Generalization)