Skip to content

Commit

Permalink
Remove LUAJIT_USE_PERFTOOLS
Browse files Browse the repository at this point in the history
This feature is not justified.
  • Loading branch information
lukego committed Mar 12, 2017
1 parent 58b063b commit d1c0e13
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions src/lj_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,41 +82,6 @@ static TraceNo trace_findfree(jit_State *J)
memcpy(p, J->cur.field, J->cur.szfield*sizeof(tp)); \
p += J->cur.szfield*sizeof(tp);

#ifdef LUAJIT_USE_PERFTOOLS
/*
** Create symbol table of JIT-compiled code. For use with Linux perf tools.
** Example usage:
** perf record -f -e cycles luajit test.lua
** perf report -s symbol
** rm perf.data /tmp/perf-*.map
*/
#include <stdio.h>
#include <unistd.h>

static void perftools_addtrace(GCtrace *T)
{
static FILE *fp;
GCproto *pt = &gcref(T->startpt)->pt;
const BCIns *startpc = mref(T->startpc, const BCIns);
const char *name = proto_chunknamestr(pt);
BCLine lineno;
if (name[0] == '@' || name[0] == '=')
name++;
else
name = "(string)";
lua_assert(startpc >= proto_bc(pt) && startpc < proto_bc(pt) + pt->sizebc);
lineno = lj_debug_line(pt, proto_bcpos(pt, startpc));
if (!fp) {
char fname[40];
sprintf(fname, "/tmp/perf-%d.map", getpid());
if (!(fp = fopen(fname, "w"))) return;
setlinebuf(fp);
}
fprintf(fp, "%lx %x TRACE_%d::%s:%u\n",
(long)T->mcode, T->szmcode, T->traceno, name, lineno);
}
#endif

/* Allocate space for copy of T. */
GCtrace * LJ_FASTCALL lj_trace_alloc(lua_State *L, GCtrace *T)
{
Expand Down Expand Up @@ -159,9 +124,6 @@ static void trace_save(jit_State *J, GCtrace *T)
setgcrefp(J->trace[T->traceno], T);
lj_gc_barriertrace(J2G(J), T->traceno);
lj_gdbjit_addtrace(J, T);
#ifdef LUAJIT_USE_PERFTOOLS
perftools_addtrace(T);
#endif
}

void LJ_FASTCALL lj_trace_free(global_State *g, GCtrace *T)
Expand Down

0 comments on commit d1c0e13

Please sign in to comment.