mirror of
https://github.com/RPCSX/xbyak.git
synced 2025-02-17 00:58:46 +00:00
perf does not recognize too short function name
This commit is contained in:
parent
6cc0f4dfc7
commit
34f797e88f
@ -6,7 +6,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#define XBYAK_NO_OP_NAMES
|
||||
#include <xbyak/xbyak_util.h>
|
||||
|
||||
const int N = 3000000;
|
||||
@ -70,9 +69,6 @@ int main(int argc, char *argv[])
|
||||
Xbyak::util::Profiler prof;
|
||||
printf("mode=%d\n", mode);
|
||||
prof.init(mode);
|
||||
/*
|
||||
func name must have three characters
|
||||
*/
|
||||
prof.set("f", (const void*)f, c.getSize());
|
||||
prof.set("g", (const void*)g, c2.getSize());
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef XBYAK_XBYAK_UTIL_H_
|
||||
#define XBYAK_XBYAK_UTIL_H_
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
utility class and functions for Xbyak
|
||||
@ -759,7 +760,7 @@ public:
|
||||
};
|
||||
Profiler()
|
||||
: mode_(None)
|
||||
, suffix_(0)
|
||||
, suffix_("")
|
||||
, startAddr_(0)
|
||||
#ifdef XBYAK_USE_PERF
|
||||
, fp_(0)
|
||||
@ -833,7 +834,16 @@ public:
|
||||
#ifdef XBYAK_USE_PERF
|
||||
if (mode_ == Perf) {
|
||||
if (fp_ == 0) return;
|
||||
fprintf(fp_, "%llx %zx %s%s\n", (long long)startAddr, funcSize, funcName, suffix_);
|
||||
fprintf(fp_, "%llx %zx %s%s", (long long)startAddr, funcSize, funcName, suffix_);
|
||||
/*
|
||||
perf does not recognize the function name which is less than 3,
|
||||
so append '_' at the end of the name if necessary
|
||||
*/
|
||||
size_t n = strlen(funcName) + strlen(suffix_);
|
||||
for (size_t i = n; i < 3; i++) {
|
||||
fprintf(fp_, "_");
|
||||
}
|
||||
fprintf(fp_, "\n");
|
||||
fflush(fp_);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user