Create profile.sh

up
This commit is contained in:
blueloveTH 2023-02-12 17:34:20 +08:00
parent b836a6be84
commit fda2338c9f
5 changed files with 14 additions and 4 deletions

7
profile.sh Normal file
View File

@ -0,0 +1,7 @@
g++ -o pocketpy src/main.cpp --std=c++17 -pg -O1 -fno-rtti
./pocketpy benchmarks/simple.py
gprof pocketpy gmon.out > gprof.txt
rm gmon.out

View File

@ -109,7 +109,7 @@ struct CodeObject {
/************************************************/ /************************************************/
}; };
static thread_local i64 kFrameGlobalId = 0; static THREAD_LOCAL i64 kFrameGlobalId = 0;
struct Frame { struct Frame {
std::vector<PyVar> _data; std::vector<PyVar> _data;

View File

@ -57,3 +57,6 @@ void* tid() {
static volatile int8_t _x; static volatile int8_t _x;
return (void*)(&_x); return (void*)(&_x);
} }
//#define THREAD_LOCAL thread_local
#define THREAD_LOCAL

View File

@ -149,7 +149,7 @@ namespace pkpy {
}; };
constexpr int kMemObjSize = sizeof(int) + sizeof(Py_<i64>); constexpr int kMemObjSize = sizeof(int) + sizeof(Py_<i64>);
static thread_local MemBlock<kMemObjSize> _mem_pool(512); static THREAD_LOCAL MemBlock<kMemObjSize> _mem_pool(512);
template<> template<>
struct SpAllocator<PyObject> { struct SpAllocator<PyObject> {

View File

@ -39,7 +39,7 @@ typedef emhash8::HashMap<Str, PyVar> NameDict;
namespace pkpy { namespace pkpy {
const int kMaxPoolSize = 10; const int kMaxPoolSize = 10;
static thread_local std::vector<PyVar*>* _args_pool = new std::vector<PyVar*>[kMaxPoolSize]; static THREAD_LOCAL std::vector<PyVar*>* _args_pool = new std::vector<PyVar*>[kMaxPoolSize];
class Args { class Args {
PyVar* _args; PyVar* _args;