Ver Fonte

Create profile.sh

up
blueloveTH há 3 anos atrás
pai
commit
fda2338c9f
5 ficheiros alterados com 14 adições e 4 exclusões
  1. 7 0
      profile.sh
  2. 1 1
      src/codeobject.h
  3. 4 1
      src/common.h
  4. 1 1
      src/obj.h
  5. 1 1
      src/safestl.h

+ 7 - 0
profile.sh

@@ -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

+ 1 - 1
src/codeobject.h

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

+ 4 - 1
src/common.h

@@ -56,4 +56,7 @@ template<typename T>
 void* tid() {
 	static volatile int8_t _x;
 	return (void*)(&_x);
-}
+}
+
+//#define THREAD_LOCAL thread_local
+#define THREAD_LOCAL

+ 1 - 1
src/obj.h

@@ -149,7 +149,7 @@ namespace pkpy {
     };
 
     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<>
     struct SpAllocator<PyObject> {

+ 1 - 1
src/safestl.h

@@ -39,7 +39,7 @@ typedef emhash8::HashMap<Str, PyVar> NameDict;
 
 namespace pkpy {
     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 {
         PyVar* _args;