奥门金沙糖果派对网站-金沙糖果派对手机版

Android培训课程-解析Data File Format Data文件格式

来源:四维梦工场    编辑:Anonymous    时间:2013/9/10    点击数:

Data File Format Data文件格式 

The data file is a binary file with the extension .data. It is structured as follows (all values are stored in little-endian order): 


Data文件是以扩展名.data的二进制文件。它的结构如下: 


   * File format:

   * header

   * record 0

   * record 1

   * ...

   *

   * Header format:

   * u4 magic 0x574f4c53 ('SLOW')

   * u2 version

   * u2 offset to data

   * u8 start date/time in usec

   *

   * Record format:

   * u1 thread ID

   * u4 method ID | method action

   * u4 time delta since start, in usec


The application is expected to parse all of the header fields, then seek to "offset to data" from the start of the file. From there it just reads 9-byte records until EOF is reached. 


u8 start date/time in usec is the output from gettimeofday(). It's mainly there so that you can tell if the output was generated yesterday or three months ago. 


method action sits in the two least-significant bits of the method word. The currently defined meanings are: 


0 - method entry 

1 - method exit 

2 - method "exited" when unrolled by exception handling 

3 - (reserved) 

An unsigned 32-bit integer can hold about 70 minutes of time in microseconds. 


程序从文件开始解析header字段,并查找“偏移数据”,每次只读9-byte,直到EOF结束。以u8开始表示来表示输出的日期/时间,这样,你可以知道是昨天还是三天以前输出的了。方法动作用2个字节来表示,定义如下: 


0 - 表示进行 

1 - 表示退出 

2 - 表示异常退出 

3 - (保留) 

32位的无符号整数可以表示70分钟以微秒为单位的时长. 




XML 地图 | Sitemap 地图