当前位置:网站首页>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
边栏推荐
猜你喜欢
PP-LiteSeg
MNIST handwritten digit recognition, sorted by from two to ten
安装pyspider后运行pyspider all后遇到的问题
Use of double pointers
target has libraries with conflicting names: libcrypto.a and libssl.a.
详解近端策略优化
亚马逊云科技Build On-Amazon Neptune基于知识图谱的推荐模型构建心得
光条提取中的连通域筛除
LeetCode_Nov_3rd_Week
度量学习(Metric learning、损失函数、triplet、三元组损失、fastreid)
随机推荐
YOLOV5 V6.1 详细训练方法
度量学习(Metric learning)—— 基于分类损失函数(softmax、交叉熵、cosface、arcface)
审稿意见回复
LeetCode_Dec_2nd_Week
sbl_init.asm-适合在编辑模式下看
多层LSTM
Transformer
MNIST手写数字识别 —— 图像分析法实现二分类
典型CCN网络——efficientNet(2019-Google-已开源)
Machine Learning - Processing of Text Labels for Classification Problems (Feature Engineering)
Copy攻城狮5分钟在线体验 MindIR 格式模型生成
第三章 标准单元库(下)
LeetCode_Nov_1st_Week
DRA821 环境搭建
bind()系统调用的用处
LeetCode_Nov_5th_Week
BatchNorm&&LayerNorm
ConnectionRefusedError: [Errno 111] Connection refused问题解决
Copy Siege Lion 5-minute online experience MindIR format model generation
fuser 使用—— YOLOV5内存溢出——kill nvidai-smi 无pid 的 GPU 进程