当前位置: 首页 > article >正文

QEMU的时间

文章目录

  • 0x1 时间的种类
    • 0x11 QEMU_CLOCK_REALTIME: Real time clock
    • 0x12 QEMU_CLOCK_VIRTUAL: virtual clock
    • 0x13 QEMU_CLOCK_HOST: host clock
    • 0x14 QEMU_CLOCK_VIRTUAL_RT: realtime clock used for icount warp
  • 0x2 使用
    • 0x21 获取时间

0x1 时间的种类

// timer.h
typedef enum {
    QEMU_CLOCK_REALTIME = 0,
    QEMU_CLOCK_VIRTUAL = 1,
    QEMU_CLOCK_HOST = 2,
    QEMU_CLOCK_VIRTUAL_RT = 3,
    QEMU_CLOCK_MAX
} QEMUClockType;

0x11 QEMU_CLOCK_REALTIME: Real time clock

The real time clock should be used only for stuff which does not change the virtual machine state,
as it runs even if the virtual machine is stopped.

不受虚拟系统的影响,随时间流逝而累加计数

0x12 QEMU_CLOCK_VIRTUAL: virtual clock

QEMU_CLOCK_VIRTUAL: virtual clock
The virtual clock only runs during the emulation.
It stops when the virtual machine is stopped.

虚拟时钟,记录GuestOS的时间滴答

0x13 QEMU_CLOCK_HOST: host clock

QEMU_CLOCK_HOST: host clock
The host clock should be used for device models that emulate accurate real time sources.
It will continue to run when the virtual machine is suspended,
and it will reflect system time changes the host may undergo (e.g. due to NTP).

HostOs的时间,类似墙上时钟,修改宿主机系统时间会改变这个时间

0x14 QEMU_CLOCK_VIRTUAL_RT: realtime clock used for icount warp

Outside icount mode, this clock is the same as @QEMU_CLOCK_VIRTUAL.
In icount mode, this clock counts nanoseconds while the virtual machine is running.
It is used to increase @QEMU_CLOCK_VIRTUAL while the CPUs are sleeping and thus not executing instructions.

在非icount模式下和QEMU_CLOCK_VIRTUAL相同,
在icount模式下于与QEMU_CLOCK_VIRTUAL不同的是在虚拟cpu休眠的时候该值也会累加

0x2 使用

0x21 获取时间

int64_t qemu_clock_get_ns(QEMUClockType type)


http://www.kler.cn/news/305998.html

相关文章:

  • uniapp的苹果全屏播放再退出会导致页面字体变大解决方法
  • 「数组」十大排序:精讲与分析(C++)
  • C++: 二叉树进阶面试题
  • Leetcode 验证回文串
  • kettle从入门到精通 第八十五课 ETL之kettle kettle中javascript步骤调用外部javascript/js文件
  • PointNet2(一)分类
  • Qt:懒汉单例(附带单例使用和内存管理)
  • 气压测试实验(用IIC)
  • Superset二次开发之源码DependencyList.tsx 分析
  • 828华为云征文 | 云服务器Flexus X实例:部署 Gitea,拥有自己的Git仓库,管理本地代码
  • 微服务之间的安全通信
  • Xorbits Inference(Xinference):一款性能强大且功能全面的大模型部署与分布式推理框架
  • TCP/IP网络模型分层
  • PCL 点云随机渲染颜色
  • 3285、找到稳定山的下标
  • 华为CNA VRM搭建(使用vmware worfstartion搭建)
  • 【Python】开发环境配置
  • Python的Scapy库详解
  • 关于 OceanBase 4.x 中被truncate的 table 不再支持进回收站的原因
  • 聚观早报 | 2025款比亚迪汉上市;iPhone 16天猫全球同步首发
  • GEO数据的下载和处理|GEO数据转换为Gene symbol|GEO注释文件提取symbol|查看样本标签|查看GEO数据疾病或正常|生物信息基础
  • 后端开发刷题 | 矩阵的最小路径和
  • 语言模型中的多模态链式推理(论文复现)
  • CSS—4
  • Go语言现代web开发defer 延迟执行
  • 【Linux 20】进程控制
  • 网络原理 IP协议与以太网协议
  • 匹配行最大值替换为最小值公式
  • 反射是一个新的AI模型,可以在一台性能良好的笔记本上运行并在测试中击败GPT-4o
  • matlab while (~feof(fid))语句解释