DTrace: pid provider

【信息科学与工程学】计算机科学与自动化 第二百三十三篇 凤凰架构02 ① Firecracker 为每个 microVM 提供极简设备模型:virtio-net, virtio-blk, serial console。:① BB84:Alice 随机选择基矢(+ 或 ×)发送单光子,Bob 随机测量基矢,比对后保留一致位的子集作为原始密钥。:密度 1 EB/mm³;:① Parquet 文件:行组(Row Group)→ 列块(Column Chunk)→ 页(Page)。 阅读详情

转载自:http://solaris.reys.net/english/archives/55-DTrace-pid-provider.html

Quite ofter we'd like to know what happens to a particular process on a
system, and if we're using DTrace for our investigation, we'd probably
use the $target variable (I've already spoked about it
in the past) or simply specify the process identifier (pid) in some
predicates of our probes, thus pointing to DTrace that we're after only
a certain process. $target variable still can and should be used when creating our probes with pid provider.





For DTrace beginners it's quite a common and good practice. But there is a better way: using the pid provider.



As it's explained in the official DTrace guide, pid provider
isn't just a provider, but in fact is a whole class of providers. And,
as the name suggests, it provides us with probes related to a certain
process.



For instance, pid737 provider allows us to trace everything happening
within a process with pid of 737. What's really cool about this provide
- it's not only easier to scope our interest, but it also gets much
easier to see how where certain probes originate from (what libraries
provide certain functions used by our process, read on - I'll explain
it a bit later).



Such a way of looking at a certain process, in contrast to using predicates like /pid == $target/,
is more correct. Instead of enabling all the specified probes by
default, and then using predicates for each probe firing for each
process on the system only to see whether we're interested in a given
process, DTrace won't even look at other processes - and pid737 will
make sure that all the probes specified will be enabled and possibly
fired only for the specified process.



We already know how to get the list of all the probes known to DTrace. I've explained
it a while ago. The thing you need to remember about the pid provider
is this: after you've used pid provider in some probes for a process, dtrace -l
will start reporting you these probes at the end of all the available
probes. They've been dynamically allocated just for you. If the process
in question dies or finishes, all the dynamically allocated probes for
its pid provider will disappear.



One more thing I really like about pid provider - modules used in
probes are in fact libraries used for the execution of the process
you're looking at. This gives you a wonderful opportunity of observing
only what's been done in your process by functions of a particular
library. Very useful.



Right, enough of theory - here's an example. First, we create a simple bit of "Hello, world!" code in C:



CODE:
void main() {

        printf("Hello, world!
");

}




After you compile it, let's get going with out DTrace script:



CODE:
#!/usr/sbin/dtrace -s

#pragma D option quiet



BEGIN {

printf("Target pid: %d
", $target);

}



pid$target:::entry {

printf("%s:%s:%s:%s
", probeprov, probemod, probefunc, probename);

}




Save the script, make it executable, and start it, specifying our hello as a command to start:



CODE:
$ ./pid-global.d -c ./hello | more

Target pid: 1059

Hello, world!

pid1059:LM1`ld.so.1:call_array:entry

pid1059:LM1`ld.so.1:call_init:entry

pid1059:LM1`ld.so.1:leave:entry

pid1059:LM1`ld.so.1:fmap_setup:entry

pid1059:LM1`ld.so.1:munmap:entry

pid1059:LM1`ld.so.1:rt_bind_clear:entry

pid1059:LM1`ld.so.1:_rt_bind_clear:entry

pid1059:LM1`ld.so.1:rt_mutex_unlock:entry

pid1059:LM1`ld.so.1:_rt_null:entry

pid1059:LM1`ld.so.1:rt_bind_clear:entry

pid1059:LM1`ld.so.1:_rt_bind_clear:entry

pid1059:libc.so.1:libc_init:entry

pid1059:libc.so.1:__amd64id:entry

pid1059:libc.so.1:atexit:entry

pid1059:libc.so.1:lmalloc:entry

pid1059:libc.so.1:getbucketnum:entry

...




You see this list of probes? I won't give you the full list - it's
going to be almost a 1000 lines, but I hope you get the idea. It's also
a perfect opportunity to see how easy it's going to be for you to track
probes of a particular library.



Back to our example, it's obvious what I'm going to do now: I'd like to get our printf caught with a probe.



CODE:
#!/usr/sbin/dtrace -s

#pragma D option quiet



BEGIN {

printf("Target pid: %d
", $target);

}



pid$target::printf:entry {

printf("%s:%s:%s:%s
", probeprov, probemod, probefunc, probename);

printf("Argument: %s
", copyinstr(arg0));

}




If we start tihs script, here's what you'll get:



CODE:
$ ./pid-printf.d -c ./hello

Target pid: 1201

Hello, world!

pid1201:libc.so.1:printf:entry

Argument: Hello, world!

           

:

node-dtrace-provider:适用于node.js应用程序的本机DTrace探针 dtrace-provider-Node.js应用程序的本机DTrace提供程序。 通过此扩展,您可以为Node.js应用程序创建本机DTrace提供程序。 也就是说,创建提供程序和探针以提供特定于您的应用程序的信息,而不是有关节点运行时的信息。 您可以使用它来公开有关应用程序内部工作的高级信息,或者创建一个特定的上下文来查看来自其他运行时或系统级提供程序的信息。 提供程序不是通过通常的方式创建的,而是先声明它,然后更改构建过程以使其包括在内,而是在运行时动态创建。 这完全在进程内完成,没有后台编译器或调用。 创建提供程序的过程无需以root用户身份运行。 安装 $ npm install dtrace-provider 例子 这是创建提供程序的简单示例: var d = require ( 'dtrace-provider' ) ; var dtp = d . createDTr 立即下载

相关推荐

避坑指南:Zephyr RTOS与nRF Connect SDK环境搭建常见错误及解决方案

本文详细解析了Zephyr RTOS与nRF Connect SDK环境搭建过程中的常见错误及解决方案,涵盖网络问题、代理设置、SEGGER Embedded Studio配置、分支切换等关键环节。针对开发者实际遇到的痛点问题,提供了一系列实用技巧和深度排错方法,帮助高效完成NCS开发环境部署。

weixin_28685287的博客 171

浅谈动态跟踪技术之DTrace

什么是动态追踪(Dynamic Tracing) 举个简单例子,一个人正在健身房里跑步,我们用摄像机

kwame211的博客 4931

LVGL项目内存告急?试试把中文字库放到SD卡里(基于LvglFontTool V0.5)

本文详细介绍了在LVGL嵌入式项目中如何通过将中文字库存储到SD卡来优化内存使用。针对Flash资源有限的MCU,如STM32F103,提供了基于LvglFontTool V0.5的外部字库生成与动态加载方案,适用于多字号、多语言及OTA场景,显著减少固件体积并提升显示灵活性。

weixin_33726318的博客 456

MAC OS 内核跟踪监视工具dtrace 使用示例说明

////////////////// syscall dtrace -ln 'syscall::write*:' //显示可使用的probe dtrace -ln 'syscall::*read*:entry' //显示可使用的probe dtrace -n 'syscall::write:entry {@dist[execname] = quantize(arg0)}' //之后C...

momo9831的博客 2011

ARM Cortex-M系列授权解析:从研发到量产的免费与付费之路

本文深入解析了ARM Cortex-M系列内核从研发到量产过程中的授权模式。研发阶段可利用ARM DesignStart等免费资源进行原型验证,但产品商业化量产则需支付授权费与版税。文章对比了采购商用MCU与自研芯片的成本差异,并探讨了RISC-V作为免费替代方案在IoT领域的应用前景与挑战,为开发者提供了清晰的选型指南。

weixin_29292431的博客 494

FPGA实现高效数字下变频:CORDIC与CIC滤波器的Verilog优化设计

本文深入探讨了FPGA实现高效数字下变频的技术方案,重点介绍了CORDIC算法与CIC滤波器的Verilog优化设计。通过详细的算法原理分析、FPGA实现技巧和实战经验分享,展示了如何利用CORDIC的旋转运算替代乘法操作,以及CIC滤波器在降采样中的高效性能。文章还提供了完整的系统集成方案和资源优化策略,为无线通信和雷达信号处理领域的工程师提供了实用参考。

redis7keeper的博客 721

selenium使用中遇到的问题

1、Exception in thread "main" org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: XP Build info: version: '2.16.1', revision:

funi16的专栏 8万+

Win10下ISE14.7 iMPACT闪退?三步搞定DLL替换(附详细路径)

本文详细介绍了在Windows 10系统下解决Xilinx ISE14.7 iMPACT工具闪退问题的三步DLL替换方案。通过替换关键DLL文件,有效解决了FPGA开发中的兼容性问题,帮助开发者快速恢复工作流程。

weixin_29290259的博客 582

dtrace 语法

Usage: dtrace [-aACeFHlqSvVwZ] [-arch i386|x86_64] [-b bufsz] [-c cmd] [-D name[=def]] [-I path] [-L path] [-o output] [-p pid] [-s script] [-U name] [-x opt[=val]] [-P provider [...

weixin_30772261的博客 533

深入剖析RDMA Netlink:Linux内核中高效通信的基石

RDMA Netlink:Linux内核中高效通信控制的核心机制 RDMA技术通过绕过内核实现高速数据传输,但其管理控制仍需内核参与。drivers/infiniband/core/netlink.c文件作为RDMA子系统的心脏,构建了用户空间与内核间的高效通信桥梁。该模块采用模块化客户端架构,通过全局数组管理不同类型的RDMA功能,如设备管理、连接服务和链路层操作。从最初的全局锁到细粒度读写锁的演进,展现了Linux内核追求高性能的持续优化。同时,通过条件编译支持新旧内核版本和网络命名空间,体现了稳定性与

数字人生 238

提示词工程在机器翻译质量提升中的应用

Introduction to Prompt Engineering in Machine Translation Quality Improvement Keywords

AI天才研究院 1151

MySQL Query Latency with the DTrace pid Provider

http://dtrace.org/blogs/brendan/2011/03/14/mysql-query-latency-with-the-dtrace-pid-provider/ 转载于:https://www.cnblogs.com/WCFGROUP/p/6013128.html

weixin_30547797的博客 90

【ARM CoreLink 系列 3 -- CCI-550 控制器介绍 】

Arm CoreLink CCI-550 Cache Coherent Interconnect 扩展了 CoreLink CCI-500。它在 big.LITTLE 处理器集群之间提供完整的缓存一致性,并为其他代理(如 Mali GPU、网络接口或加速器)提供 I/O 一致性。CoreLink CCI-550 提供可扩展和可配置的互连,使 SoC 设计人员能够以尽可能小的面积和功耗满足性能目标,并且还增加了可降低整体系统延迟的监听滤波器。

CodingCos的博客 2210

DTrace C++ Mysteries Solved

I’ve been using DTrace on Leopard in my recent work, and while it’s a great tool, the C++ support is confusing and I couldn’t find proper documentation. But eventually I found sketchy documentation

Simplify is Important 803

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

XNU内核架构深度解析:macOS/iOS操作系统的核心引擎实现原理

XNU内核作为苹果macOS和iOS操作系统的核心引擎,采用了独特的混合架构设计,融合了Mach微内核的灵活性、BSD Unix的稳定性和I/O Kit的设备驱动框架。本文将深入剖析XNU内核的5大核心子系统实现原理,探索其高性能、高安全性的技术奥秘。 ## 一、XNU混合内核架构的三大支柱 ### 1.1 Mach微内核:消息传递与资源抽象 Mach微内核构成了XNU的底层基础,它通过**消

gitblog_00797的博客 667

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

galera cluster安装与配置

galera cluster安装与配置 由于公司数据量与并发的日渐增大,普通的主从复制已无法满足要求。对比了网上PXC、galera、mysql cluster等方案,最终决定选择galera cluster。 以下为安装步骤: 1、下载galera for m...

diaozhou2796的博客 453

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

DTrace

很少有人听过 DTrace,它是隐藏在 OS 中的小宝藏。DTrace 是强大的 debug 工具 - 因为它拥有极其灵活的特性,并且因为与其它工具差异很大而可能相对不那么有名。 许多时候你的 app 的真正的用户或测试人员会看到一些意外的行为。DTrace 可以让你无需重启 app 就能够在生产版本上回答关于 app 的任何问题。 动态追踪 大概 10 年前,Sun Micro

fishmai的专栏 3336

list

的底层是双向链表结构,双向链表中每个元素存储在互不相关的独立节点中,在节点中通过指针指向其前一个元素和后一个元素。,因此反向迭代器的实现可以借助正向迭代器,即:反向迭代器内部可以包含一个正向迭代器,对正向迭代器的接口进行包装即可。是可以在常数范围内在任意位置进行插入和删除的序列式容器,并且该容器可以前后双向迭代。迭代到该位置,在这段位置上迭代需要线性的时间开销;最大的缺陷是不支持任意位置的随机访问,比如:要访问。还需要一些额外的空间,以保存每个节点的相关联信息。个元素,必须从已知的位置。

xie0510_的博客 271

Java 集合框架(List、Set、Map)与常用基础

本文整理Java集合框架核心知识,涵盖集合体系、Collection接口API、List(ArrayList、LinkedList、Vector)、Set(HashSet、TreeSet)、Map(HashMap、TreeMap、Hashtable)实现类原理、泛型、增强for循环、可变参数与工具类,并附核心易错点速查表。

既然你都点开这里了,那可以给我点个关注吗?可以吗?可以吗? 483

Bugku 326 Baby-heap1 题解:glibc 2.23 堆溢出到 FSOP 劫持 _IO_list_all(附完整 exp)

为什么 FSOP 在 2.23 这么好用?glibc 2.23 的_IO_FILE虚表调用没有 vtable 合法性检查是 2.24 才加入的),只要能把指向自己伪造的 FILE,就能让__overflow槽位指向任意函数。exit()一定会走因此把_mode置 0、置 1、置 0,就能进入;把fp首地址写成/bin/shsystem(fp)的参数就齐了。为什么用 fastbin attack 而不是?2.23 没有 tcache,fastbin 的fd。

kingx3的博客 189

LinkedList知识

LinkedList是List 接口的实现类,同时实现了Deque有序、可重复、带索引双向链表prev前驱指针 + item数据 + next后继指针✅ 核心特点首尾增删速度快:只修改指针,不需要移动元素查询慢:没有数组随机访问,按索引查找需要遍历链表线程不安全,支持存储 null兼具 List、队列、栈的功能,所以有两套首尾 API(一组抛异常,一组返回 null)ArrayList:可变数组 → 查询快,中间增删慢LinkedList:双向链表 → 首尾增删快,查询慢多态写时,

Sarvartha的博客 89

Iterator 迭代器、ListIterator & foreach 循环

foreach 是简化版 for 循环,底层依然是 Iterator 迭代器(语法糖)适用范围:数组、所有实现Iterablefor(容器中元素类型 临时变量 : 容器变量) {执行语句hasNext()只判断,不移动指针;不能连续多次调用next(),容易泛型缺失时,Iterator 取出元素是 Object,需要强制转换只能 List 获取,Set 集合不能使用增强 for 只是语法糖,编译后依然变成 Iterator,同样不能在遍历时直接调用集合增删方法。

Sarvartha的博客 347

[C++]:7.STL:list

好久不见,firdawn小课堂又和大家见面啦。今天我们要学习的内容是list容器,list也是一种常用的数据结构。下面是本章的思维导图,那么让我们开始学习吧!自定义的list,由三个结构构成。分别是链表的最小组成单位,也就是链表节点。以及迭代器类和list类其实要特别说明的是, List的迭代器,它不是单纯的指针,因为我们如果对指针直接进行解引用操作的话,我们得到的是这个节点,而不是节点里面存储的值并且我们对这个指针加加,得到的也不是下一个节点的地址,而是所在节点的下一个单位的地址。

2301_80817679的博客 182

List 接口 & ArrayList

List 是Collection 的子接口(单列集合)有序:存入顺序和取出顺序一致可重复:允许存储重复元素有索引:支持根据索引操作元素(这是 List 独有的!Set 没有索引)所以 Collection 里所有方法,List 全都可以用,同时 List 新增一套带索引的专属方法ArrayList 是实现类,实现了 List 接口有序、可重复、有索引底层数组,查询快、中间增删慢扩容 1.5 倍;空参构造不会立刻创建长度 10 数组,JDK8 是懒加载线程不安全,不同步。

Sarvartha的博客 345

一个链表(Linked List)--为什么要用链表--deepseek

数组(如你定义的大盘子就像你在 FPGA 里例化了一块深度为 2500 的 BRAM。它必须是一块连续的、完整的内存。如果内存里全是碎片,凑不出 2500 个连续空位,数组就建立不起来。链表(Linked List)就像一堆散落在大街小巷的小仓库,每个仓库大小不固定,彼此不挨着。但是,每个仓库的门口都贴了一张小纸条,纸条上写着“下一个仓库的地址”。我们来画个图,这就是链表的核心——节点(Node)text。

AlibabaApple的博客 165
上一篇: DTrace即动态跟踪Dynamic Tracing
下一篇: Solaris 10 X86安装备忘
silvbb
博客等级 码龄21年 1粉丝 6原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值