Xentrace使用教程

2021-06-16 08:13:14 字數 1967 閱讀 3870

介紹:name

xentrace - capture xen trace buffer data

synopsis 

xentrace [ options ] [ file ]

description 

xentrace is used to capture trace buffer data from xen. the data is output in the following binary format (host endian):     cpu(uint) tsc(u64) event(u32) d1 d2 d3 d4 d5 (all u32)

where cpu is the processor number, tsc is the record's timestamp (the value of the cpu cycle counter), event is the event id and d1...d5 are the trace data.

data is dumped onto the standard output (which must not be a tty) or a file specified on the command line.

the output should be parsed using the tool xentrace_format, which can produce human-readable output in ascii format.

簡單來說,xentrace是用來獲取系統執行過程中一些動態資訊的工具,類似windows下的日誌。

一般使用:

系統啟動xen之後,就可以使用xentrace和xentrace_format命令了。

獲取輸出命令:xentrace -d -t 10 rec.raw

其中-d引數表明清空之前快取的資料

-t後面跟的時間,表示需要獲取多長時間的資料(從該命令執行起開始,單位是s)

將輸出格式化為可讀資訊命令:cat rec.raw | xentrace_format formats >rec.txt

其中formats檔案是xen目錄中帶的,一般在tools/xentrace下

原理**:

檢視xen源**可以知道,通過xentrace獲取的資料是通過trace_2d、trace_3d(2d、3d中2和3是指引數的個數)等這些記錄的資料,例如:

/xen/common/schedule.c

243 void vcpu_wake(struct vcpu *v)

244

ok,xen源**修改完畢,為了能夠生效,我們需要重新編譯我們的xen,可以使用make xen命令來編譯,編譯之後重啟系統即可生效。

下面我們來測試下我們新增的trace是否有記錄,獲取乙個10s的trace資訊:

xentrace -d -t 10 rec.raw

獲取之後,我們需要通過formats來格式化該二進位制資料。由於我們新增了新的事件型別,因此我們需要先修改我們的formats檔案:

tools/xentrace/formats

26 0x00028010  cpu%(cpu)d  %(tsc)d (+%(reltsc)8d)  do_tickle          [ domid = 0x%(1)08x, edomid     = 0x%(2)08x ]

修改之後儲存,然後執行如下命令:

cat rec.raw | xentrace_format formats >rec.txt

這個命令執行需要一些時間,慢慢等待會。。。

完成之後檢視我們生成的rec.txt檔案,查詢tickle,如果可以看到類似如下的記錄:

14200 cpu0  519304896957 (+    1183)  do_tickle          [ domid = 0x00007fff, edomid = 0x00000000       ]

congratulations! ^-^

by spri1987 2010-6-22

SVN使用使用教程

本人在公司孤兒式開發,是用不到svn這種工具的,但是怕突然某一天電腦壞掉,消失所以還是使用上 管理工具。簡單概括一下svn它是 幹什麼的 一群人寫 每乙個人寫的部分都不一樣,但是專案是乙個整體,每個人的 需要合到一起才是乙個完整的專案,但是每乙個人寫的 又不可能出現在其他人的電腦上,所以使用svn專...

Git使用教程

提起git,大家無疑會想到github,沒錯,我就是通過眾多的github專案鏈結了解到的git,不知你是否也在走這條路呢?如果是的話,本文有一些有用的總結性文字以及一些 git教程 可以教會你如何去使用 git.當然,這些對 github 同樣適用.這裡我又翻到了個幻燈片,可以供大家 寫給大家的 ...

mii tool使用教程

mii tool 這是專門設定網絡卡工作模式的命令 1.檢視網絡卡的工作模式,輸入命令 mii tool v eth0 negotiated 100basetx fd,link ok product info vendor 00 05 be,model 8 rev 0 basic status au...