aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorStephane Eranian <eranian@google.com>2016-10-13 06:59:37 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-10-24 10:07:38 -0400
commit13b9012ab42ee93dabe8555f2e701ca139180f85 (patch)
treeb78b3d45d4c801a718613fe0df4439c0aaf983e6 /tools/perf
parent621cb4e7837e39d25a5af5a785ad282cdd2b4ce8 (diff)
perf jit: Remove unecessary padding in jitdump file
This patch removes all the string padding generated in the jitdump file. They are not necessary and were adding unnecessary complexity. Modern processors can handle unaligned accesses quite well. The perf.data/ jitdump file are always post-processed, no need to add extra complexity for no real gain. Signed-off-by: Stephane Eranian <eranian@google.com> Cc: Anton Blanchard <anton@ozlabs.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1476356383-30100-4-git-send-email-eranian@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/jvmti/jvmti_agent.c38
1 files changed, 1 insertions, 37 deletions
diff --git a/tools/perf/jvmti/jvmti_agent.c b/tools/perf/jvmti/jvmti_agent.c
index 55daefff0d54..e9651a9d670e 100644
--- a/tools/perf/jvmti/jvmti_agent.c
+++ b/tools/perf/jvmti/jvmti_agent.c
@@ -44,11 +44,6 @@
44static char jit_path[PATH_MAX]; 44static char jit_path[PATH_MAX];
45static void *marker_addr; 45static void *marker_addr;
46 46
47/*
48 * padding buffer
49 */
50static const char pad_bytes[7];
51
52static inline pid_t gettid(void) 47static inline pid_t gettid(void)
53{ 48{
54 return (pid_t)syscall(__NR_gettid); 49 return (pid_t)syscall(__NR_gettid);
@@ -230,7 +225,6 @@ init_arch_timestamp(void)
230 225
231void *jvmti_open(void) 226void *jvmti_open(void)
232{ 227{
233 int pad_cnt;
234 char dump_path[PATH_MAX]; 228 char dump_path[PATH_MAX];
235 struct jitheader header; 229 struct jitheader header;
236 int fd; 230 int fd;
@@ -288,10 +282,6 @@ void *jvmti_open(void)
288 header.total_size = sizeof(header); 282 header.total_size = sizeof(header);
289 header.pid = getpid(); 283 header.pid = getpid();
290 284
291 /* calculate amount of padding '\0' */
292 pad_cnt = PADDING_8ALIGNED(header.total_size);
293 header.total_size += pad_cnt;
294
295 header.timestamp = perf_get_timestamp(); 285 header.timestamp = perf_get_timestamp();
296 286
297 if (use_arch_timestamp) 287 if (use_arch_timestamp)
@@ -301,13 +291,6 @@ void *jvmti_open(void)
301 warn("jvmti: cannot write dumpfile header"); 291 warn("jvmti: cannot write dumpfile header");
302 goto error; 292 goto error;
303 } 293 }
304
305 /* write padding '\0' if necessary */
306 if (pad_cnt && !fwrite(pad_bytes, pad_cnt, 1, fp)) {
307 warn("jvmti: cannot write dumpfile header padding");
308 goto error;
309 }
310
311 return fp; 294 return fp;
312error: 295error:
313 fclose(fp); 296 fclose(fp);
@@ -349,7 +332,6 @@ jvmti_write_code(void *agent, char const *sym,
349 static int code_generation = 1; 332 static int code_generation = 1;
350 struct jr_code_load rec; 333 struct jr_code_load rec;
351 size_t sym_len; 334 size_t sym_len;
352 size_t padding_count;
353 FILE *fp = agent; 335 FILE *fp = agent;
354 int ret = -1; 336 int ret = -1;
355 337
@@ -366,8 +348,6 @@ jvmti_write_code(void *agent, char const *sym,
366 348
367 rec.p.id = JIT_CODE_LOAD; 349 rec.p.id = JIT_CODE_LOAD;
368 rec.p.total_size = sizeof(rec) + sym_len; 350 rec.p.total_size = sizeof(rec) + sym_len;
369 padding_count = PADDING_8ALIGNED(rec.p.total_size);
370 rec.p. total_size += padding_count;
371 rec.p.timestamp = perf_get_timestamp(); 351 rec.p.timestamp = perf_get_timestamp();
372 352
373 rec.code_size = size; 353 rec.code_size = size;
@@ -393,9 +373,6 @@ jvmti_write_code(void *agent, char const *sym,
393 ret = fwrite_unlocked(&rec, sizeof(rec), 1, fp); 373 ret = fwrite_unlocked(&rec, sizeof(rec), 1, fp);
394 fwrite_unlocked(sym, sym_len, 1, fp); 374 fwrite_unlocked(sym, sym_len, 1, fp);
395 375
396 if (padding_count)
397 fwrite_unlocked(pad_bytes, padding_count, 1, fp);
398
399 if (code) 376 if (code)
400 fwrite_unlocked(code, size, 1, fp); 377 fwrite_unlocked(code, size, 1, fp);
401 378
@@ -412,7 +389,6 @@ jvmti_write_debug_info(void *agent, uint64_t code, const char *file,
412{ 389{
413 struct jr_code_debug_info rec; 390 struct jr_code_debug_info rec;
414 size_t sret, len, size, flen; 391 size_t sret, len, size, flen;
415 size_t padding_count;
416 uint64_t addr; 392 uint64_t addr;
417 const char *fn = file; 393 const char *fn = file;
418 FILE *fp = agent; 394 FILE *fp = agent;
@@ -443,16 +419,10 @@ jvmti_write_debug_info(void *agent, uint64_t code, const char *file,
443 * int : line number 419 * int : line number
444 * int : column discriminator 420 * int : column discriminator
445 * file[] : source file name 421 * file[] : source file name
446 * padding : pad to multiple of 8 bytes
447 */ 422 */
448 size += nr_lines * sizeof(struct debug_entry); 423 size += nr_lines * sizeof(struct debug_entry);
449 size += flen * nr_lines; 424 size += flen * nr_lines;
450 /* 425 rec.p.total_size = size;
451 * pad to 8 bytes
452 */
453 padding_count = PADDING_8ALIGNED(size);
454
455 rec.p.total_size = size + padding_count;
456 426
457 /* 427 /*
458 * If JVM is multi-threaded, nultiple concurrent calls to agent 428 * If JVM is multi-threaded, nultiple concurrent calls to agent
@@ -486,12 +456,6 @@ jvmti_write_debug_info(void *agent, uint64_t code, const char *file,
486 if (sret != 1) 456 if (sret != 1)
487 goto error; 457 goto error;
488 } 458 }
489 if (padding_count) {
490 sret = fwrite_unlocked(pad_bytes, padding_count, 1, fp);
491 if (sret != 1)
492 goto error;
493 }
494
495 funlockfile(fp); 459 funlockfile(fp);
496 return 0; 460 return 0;
497error: 461error: