5.54 BCC工具之dbstat.py解读

一,工具简介

dbstat工具用于追踪由 MySQL 或 PostgreSQL 数据库进程执行的查询,并显示查询延迟的直方图。

二,代码示例

#!/usr/bin/env python

from bcc import BPF, USDT
import argparse
import subprocess
from time import sleep, strftime

examples = """
    dbstat postgres     # display a histogram of PostgreSQL query latencies
    dbstat mysql -v     # display MySQL latencies and print the BPF program
    dbstat mysql -u     # display query latencies in microseconds (default: ms)
    dbstat mysql -m 5   # trace only queries slower than 5ms
    dbstat mysql -p 408 # trace queries in a specific process
"""
parser = argparse.ArgumentParser(
    description="",
    formatter_class=argparse.RawDescriptionHelpFormatter,
    epilog=examples)
parser.add_argument("-v", "--verbose", action="store_true",
    help="print the BPF program")
parser.add_argument("db", choices=["mysql&#

相关推荐

  1. 5.54 BCC工具dbstat.py解读

    2024-03-10 07:14:09       46 阅读
  2. 5.8 BCC工具mysqld_query.py解读

    2024-03-10 07:14:09       52 阅读
  3. 5.56 BCC工具funcslower.py解读

    2024-03-10 07:14:09       45 阅读
  4. 5.53 BCC工具dbslower.py解读

    2024-03-10 07:14:09       41 阅读
  5. 5.49 BCC工具rdmaucma.py解读

    2024-03-10 07:14:09       42 阅读
  6. 5.52 BCC工具dbslower.py解读

    2024-03-10 07:14:09       47 阅读
  7. 5.69 BCC工具runqlen.py解读

    2024-03-10 07:14:09       46 阅读
  8. 5.82 BCC工具tcpdrop.py解读

    2024-03-10 07:14:09       39 阅读
  9. 5.70 BCC工具runqslower.py解读

    2024-03-10 07:14:09       35 阅读
  10. 5.72 BCC工具wakeuptime.py解读

    2024-03-10 07:14:09       43 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-10 07:14:09       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-10 07:14:09       100 阅读
  3. 在Django里面运行非项目文件

    2024-03-10 07:14:09       82 阅读
  4. Python语言-面向对象

    2024-03-10 07:14:09       91 阅读

热门阅读

  1. 【NERF】入门学习整理(一)

    2024-03-10 07:14:09       46 阅读
  2. 【趣味学算法】00_百鸡百钱

    2024-03-10 07:14:09       32 阅读
  3. CentOS 7升级openssh9.6p1

    2024-03-10 07:14:09       50 阅读
  4. 微信小程序常用标签

    2024-03-10 07:14:09       53 阅读
  5. Rust 读写csv文件

    2024-03-10 07:14:09       46 阅读
  6. 计算机网络-网络应用服务器(四)

    2024-03-10 07:14:09       49 阅读