一,工具简介
wakeuptime工具追踪工作在工作队列中的等待情况,并记录工作的排队延迟(时间)分布,当按下 Ctrl-C 时,将其以直方图的形式打印出来。
二,代码示例
#!/usr/bin/env python
from __future__ import print_function
from bcc import BPF
from time import sleep, strftime
import argparse
import sys
# arguments
examples = """examples:
./wqlat # summarize workqueue latency as a histogram
./wqlat 1 10 # print 1 second summaries, 10 times
./wqlat -W 1 10 # print 1 second, 10 times per workqueue
./wqlat -NT 1 # 1s summaries, nanoseconds, and timestamps
./wqlat -w nvmet_tcp_wq 1 # 1s summaries for workqueue nvmet_tcp_wq
"""
parser = argparse.ArgumentParser(
description="Summarize workqueue request latency as histograms.",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=examples)
parser.add_argument("-T", "--timestam