[转帖]heapmap

heapmap · 浏览次数 : 0

小编点评

**HeatMapSome Software** The provided software, `trace2heatmap.pl`, allows you to generate interactive SVG heat maps from trace files. It takes input data in a specific format and uses the following steps to create the heat map: 1. **Reads trace data:** - Takes input as two numerical columns: time and latency. - Each row represents an event (e.g., an I/O). - The first column is time, and the second column is latency. 2. **Performs normalization:** - Normalizes the latency range to a specified maximum value (10000 us by default). - Uses the `minlat` and `maxlat` options to specify the range to be plotted. 3. **Generates the heat map:** - Uses `svgwrite` to create an SVG image. - The x-axis is time, and the y-axis is latency. - Each rectangle represents a latency range, with width determined by the difference between `minlat` and `maxlat`. - The height of each rectangle is proportional to the number of events in that range. 4. **Sets grid lines:** - Uses the `grid` option to draw grid lines on the heat map. 5. **Provides metadata:** - When you hover over a rectangle, it displays additional information, including: - Time - Latency range (y-axis) - Number of events - Percentage of events - Accumulated count **Usage:** 1. Clone or download the repository. 2. Run the script with the input trace file as `trace2heatmap.pl --unitstime=us --unitslabel=us --maxlat=2000 --grid example-trace.txt > example-heatmap.svg` (replace `example-trace.txt` with your actual trace file). **Example Output:** The script will generate an SVG file named `example-heatmap.svg` that contains a heat map of the input trace data. The heat map shows the latency values on the y-axis and the time values on the x-axis. **Note:** The script is written in Perl, but it can be easily adapted for other programming languages.

正文

https://github.com/brendangregg/HeatMap

 


HeatMap Some software to generate heat maps: trace2heatmap.pl converts a trace of per-event latency to an interactive SVG heat map. See http://dtrace.org/blogs/brendan/2013/05/19/revealing-hidden-latency-patterns trace2heatmap ============= This is a quick program to generate heat maps from trace files. I wrote it in 3 hours, so it's probably buggy (especially input checking). It takes input as two numerical columns, a time and a latency. For example: $ more trace.txt 17442020318913 8026 17442020325950 6798 17442020333082 6907 17442020339374 6065 [...] Each row is an event (eg, an I/O). The first column is time of the event and the second is latency. In this example, both columns are microseconds. See the later Generating Latency Traces section for how to generate these. This example can converted into an SVG heatmap using: $ ./trace2heatmap.pl --unitstime=us --unitslabel=us trace.txt > heatmap.svg Other units can also be used ("ms", "ns"). The y-axis will auto-scale to include everything, including latency outliers. While useful, you generally want to generate a second heatmap that excludes those so you can study the bulk of the data. Eg: $ ./trace2heatmap.pl --unitstime=us --unitslabel=us --maxlat=10000 trace.txt > heatmap2.svg This limits the latency range to 10000 us. A --minlat option can also be used. Run --help for the full list, which includes --titletext to customize the title, and --grid to draw grid lines. When doing a mouse-over of rectangles (histogram buckets), the following information will be displayed at the bottom of the heat map: - time: elapsed time in seconds. - range: latency range (y-axis) shown by the rectangle. - count: number of events in this rectangle (time and latency range). - pct: shows number of events in this rectangle as a percentage of all those in the column. - acc: accumulated count, counting from bottom-up in the column. - acc pct: accumulated count as a percentage. This can be used to find the percentile points. trace2heatmap can generate other heat maps, not just latency. As an example of another type, see the utilization heat map in: http://dtrace.org/blogs/brendan/2011/12/18/visualizing-device-utilization Generating Latency Traces ========================= An example trace file is included, example-trace.txt, which was generated using a DTrace program called iosnoop (from the DTraceToolkit): $ ./iosnoop -Dt > out.iosnoop $ awk '{ print $1, $2 }' out.iosnoop > example-trace.txt These are performed as separate steps so that the original iosnoop output can be reinspected to see more details if interesting features were found in the heat map. I typically run it with "iosnoop -Dots". Note that most versions of iosnoop need dynvarsize increased to avoid "dynamic variable drops": find the line that has "#pragma D option quiet" and add the following line below it: "#pragma D option dynvarsize=16m". Here's an example DTrace one-liner that will generate trace output, both columns in microseconds, for syscall reads: $ dtrace -qn 'syscall::read:entry { self->ts = timestamp; } syscall::read:return /self->ts/ { printf("%d %d\n", timestamp / 1000, (timestamp - self->ts) / 1000); self->ts = 0; }' This is system-wide; add a predicate to filter for applications. I could add more examples, but you probably get the picture: anything that can emit times and latency can be processed. Tracing in Production ===================== Tracing per-event latency can be expensive to perform. DTrace minimizes the overheads as much as possible using per-CPU buffers and asynchronous kernel- user transfers; other tools (eg, strace, tcpdump) are expected to have higher overhead. This can cause problems for production use: you wan to understand the overhead, including when using DTrace, before tracing events. Heat maps have been used successfully in production -- and recorded at a one second granularity 24x7x365 -- by some products built upon DTrace. These use the DTrace aggregating feature to pass a quantized summary of latency to user-level, instead of every event, cutting the data transfer down by a large factor (eg, 1000x). This summary may consist of a per-second array with about 200 elements for different latency ranges, each containing the count of events, and is from the DTrace aggregating actions @quantize, @lquantize, or @llquantize (best). This array is then resampled (downsampled) to the resolution desired for the heat map (usually down to 30 or so levels). Example products that do this are the Oracle ZFS Storage Appliance, and Joyent Cloud Analytics. Provided Example ================ An example output is included of a disk I/O trace, and the resulting heat map. You can generate it using: $ ./trace2heatmap.pl --unitstime=us --unitslabel=us --maxlat=2000 --grid example-trace.txt > example-heatmap.svg This excluded outliers, so that the bulk of the I/O could be examined.

与[转帖]heapmap相似的内容:

[转帖]heapmap

https://github.com/brendangregg/HeatMap HeatMap Some software to generate heat maps: trace2heatmap.pl converts a trace of per-event latency to an inte

[转帖]

Linux ubuntu20.04 网络配置(图文教程) 因为我是刚装好的最小系统,所以很多东西都没有,在开始配置之前需要做下准备 环境准备 系统:ubuntu20.04网卡:双网卡 网卡一:供连接互联网使用网卡二:供连接内网使用(看情况,如果一张网卡足够,没必要做第二张网卡) 工具: net-to

[转帖]

https://cloud.tencent.com/developer/article/2168105?areaSource=104001.13&traceId=zcVNsKTUApF9rNJSkcCbB 前言 Redis作为高性能的内存数据库,在大数据量的情况下也会遇到性能瓶颈,日常开发中只有时刻

[转帖]ISV 、OSV、 SIG 概念

ISV 、OSV、 SIG 概念 2022-10-14 12:29530原创大杂烩 本文链接:https://www.cndba.cn/dave/article/108699 1. ISV: Independent Software Vendors “独立软件开发商”,特指专门从事软件的开发、生产、

[转帖]Redis 7 参数 修改 说明

2022-06-16 14:491800原创Redis 本文链接:https://www.cndba.cn/dave/article/108066 在之前的博客我们介绍了Redis 7 的安装和配置,如下: Linux 7.8 平台 Redis 7 安装并配置开机自启动 操作手册https://ww

[转帖]HTTPS中间人攻击原理

https://www.zhihu.com/people/bei-ji-85/posts 背景 前一段时间,公司北京地区上线了一个HTTPS防火墙,用来监听HTTPS流量。防火墙上线之前,邮件通知给管理层,我从我老大那里听说这个事情的时候,说这个有风险,然后意外地发现,很多人原来都不知道HTTPS防

[转帖]关于字节序(大小端)的一点想法

https://www.zhihu.com/people/bei-ji-85/posts 今天在一个技术群里有人问起来了,当时有一些讨论(不完全都是我个人的观点),整理一下: 为什么网络字节序(多数情况下)是大端? 早年设备的缓存很小,先接收高字节能快速的判断报文信息:包长度(需要准备多大缓存)、地

[转帖]awk提取某一行某一列的数据

https://www.jianshu.com/p/dbcb7fe2da56 1、提取文件中第1列数据 awk '{print $1}' filename > out.txt 2、提取前2列的文件 awk `{print $1,$2}' filename > out.txt 3、打印完第一列,然后打

[转帖]awk 中 FS的用法

https://www.cnblogs.com/rohens-hbg/p/5510890.html 在openwrt文件 ar71xx.sh中 查询设备类型时,有这么一句, machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /

[转帖]Windows Server 2022 简体中文版、英文版下载 (updated Oct 2022)

https://sysin.org/blog/windows-server-2022/ Windows Server 2022 正式版,2022 年 10 月更新,VLSC Posted by sysin on 2022-10-27 Estimated Reading Time 8 Minutes