Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: Leo Yan <[email protected]>
  • Loading branch information
Leo Yan committed Nov 16, 2017
1 parent 63cbb32 commit 8215d8a
Showing 1 changed file with 38 additions and 180 deletions.
218 changes: 38 additions & 180 deletions extensions/csdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,196 +328,42 @@ static unsigned int perf_record_finish[] = {
};

static unsigned int perf_sections[] = {
0x000027e0, 0x00000000, 0x00000064, 0x00000000,
0x00002844, 0x00000000, 0x00000018, 0x00000000,
0x0000285c, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
/*
0x000029d4, 0x00000000, 0x00000044, 0x00000000,
0x00002a18, 0x00000000, 0x00000044, 0x00000000,
0x00002a5c, 0x00000000, 0x00000044, 0x00000000,
0x00002aa0, 0x00000000, 0x00000044, 0x00000000,
0x00002ae4, 0x00000000, 0x00000008, 0x00000000,
0x00002aec, 0x00000000, 0x00000008, 0x00000000,
0x00002af4, 0x00000000, 0x0000019c, 0x00000000,
0x00002c90, 0x00000000, 0x00000188, 0x00000000,
0x00002e18, 0x00000000, 0x000002f0, 0x00000000,
0x00003108, 0x00000000, 0x0000005c, 0x00000000,
0x00003164, 0x00000000, 0x000000dc, 0x00000000,
0x00003240, 0x00000000, 0x00000018, 0x00000000,
0x00003258, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
*/
0x00002760, 0x00000000, /* buildid section: start addr */
0x00000064, 0x00000000, /* buildid section: len */
0x000027c4, 0x00000000, /* auxtrace section: start addr */
0x00000018, 0x00000000, /* auxtrace section: len */
0x000027dc, 0x00000000,
0x00000000, 0x00000000,
0x00000000, 0x00000000,
0x00000000, 0x00000000,
};

static unsigned int perf_sections_feat[] = {
0x00000000, 0x00640001, 0xffffffff, 0xc9b5ee32,
0xa6009dc9, 0xcb21093d, 0x23c315d8, 0x1067c385,
0x00000000, 0x72656b5b, 0x2e6c656e, 0x6c6c616b,
0x736d7973, 0x0000005d, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000,
/*
0x00000040, 0x616e696c, 0x642d6f72,
0x6c657665, 0x7265706f, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000040, 0x32312e34,
0x722d302e, 0x302d3363, 0x30323030, 0x6563672d,
0x35643530, 0x00000032, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000040,
0x31312e34, 0x3163722e, 0x3866672e, 0x31633032,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000040, 0x63726161, 0x00343668, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000008, 0x00000008, 0x000ce050,
0x00000000, 0x00000006, 0x00000040, 0x6f6f722f,
0x65702f74, 0x00006672, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000040,
0x6f636572, 0x00006472, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000040, 0x0000652d, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000040, 0x655f7363, 0x402f6d74,
0x30343666, 0x30303032, 0x6674652e, 0x0000002f,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000040, 0x65702d2d,
0x68742d72, 0x64616572, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000040,
0x696e6170, 0x00000063, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000002, 0x00000070, 0x00000006, 0x00000070,
0x00000000, 0x00000000, 0x00000001, 0x00000000,
0x00010003, 0x00000000, 0x00000004, 0x00000000,
0x00141001, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000001, 0x00000040,
0x655f7363, 0x402f6d74, 0x30343666, 0x30303032,
0x6674652e, 0x0000002f, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000015, 0x00000000, 0x00000001, 0x00000070,
0x00000009, 0x00000000, 0x00000001, 0x00000000,
0x00010003, 0x00000000, 0x00000004, 0x00000000,
0x01843361, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000001, 0x00000040,
0x6d6d7564, 0x00753a79, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000016, 0x00000000, 0x00000002, 0x00000040,
0x00332d30, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000040, 0x00372d34, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000008, 0x00000040, 0x00000030,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000040,
0x00000031, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000040, 0x00000032, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000040, 0x00000033, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000040, 0x00000034,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000040,
0x00000035, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000040, 0x00000036, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000040, 0x00000037, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000000, 0x00000002, 0x00000000,
0x00000003, 0x00000000, 0x00000000, 0x00000001,
0x00000001, 0x00000001, 0x00000002, 0x00000001,
0x00000003, 0x00000001, 0x00000001, 0x00000000,
0x000ce050, 0x00000000, 0x000ae82c, 0x00000000,
0x00000040, 0x00372d30, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000006, 0x00000040,
0x655f7363, 0x00006d74, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000005, 0x00000040, 0x61657262, 0x696f706b,
0x0000746e, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000001, 0x00000040,
0x74666f73, 0x65726177, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
*/
0x00000001, 0x00000000, 0x000006a8, 0x00000000,
0x00000030, 0x00000000,
0x00000000, 0x00640001,
0xffffffff, 0xc9b5ee32,
0xa6009dc9, 0xcb21093d,
0x23c315d8, 0x1067c385,
0x00000000, 0x72656b5b,
0x2e6c656e, 0x6c6c616b,
0x736d7973, 0x0000005d,
0x00000000, 0x00000000,
0x00000000, 0x00000000,
0x00000000, 0x00000000,
0x00000000, 0x00000000,
0x00000000, 0x00000000,
0x00000000,

0x00000001, 0x00000000,
0x000006a8, 0x00000000,
0x00000030, 0x00000000,
};

static int csdump_perfdata(void)
{
FILE *out_fp;
int online_cpus, i;
int trace_len = 0;
int ret;
int pos, diff;

if ((out_fp = fopen("./perf.data", "w")) == NULL) {
fprintf(fp, "Cannot open file\n");
Expand Down Expand Up @@ -559,6 +405,18 @@ static int csdump_perfdata(void)
fwrite(perf_record_finish, sizeof(perf_record_finish), 1, out_fp);
trace_len += sizeof(perf_record_finish);

pos = ftell(out_fp);
pos += sizeof(perf_sections);

diff = perf_sections[0] - pos;

for (i = 0; i < sizeof(perf_sections) / 4; i += 4) {
if (!perf_sections[i])
continue;

perf_sections[i] = perf_sections[i] - diff;
}

fwrite(perf_sections, sizeof(perf_sections), 1, out_fp);
fwrite(perf_sections_feat, sizeof(perf_sections_feat), 1, out_fp);

Expand Down

0 comments on commit 8215d8a

Please sign in to comment.