BLUELOVETH 65440c2034
Fix #197 (#227)
* init

* some optimize

* Update frame.h

* remove `LOAD_INTEGER`

* Update vm.cpp

* some optimize

* some fix

* Revert "remove `LOAD_INTEGER`"

This reverts commit c0b965aee2f64fbfae0b20f41d714688649d20cf.

* some fix

* Update expr.cpp

* some fix

* Update retype.yml
2024-03-16 18:37:09 +08:00

36 lines
657 B
C++

#pragma once
#include "frame.h"
namespace pkpy {
struct _LineRecord{
int line;
i64 hits;
clock_t time;
_LineRecord(): line(-1), hits(0), time(0) {}
bool is_valid() const { return line != -1; }
};
struct _FrameRecord{
LinkedFrame* frame;
clock_t prev_time;
_LineRecord* prev_record;
};
struct LineProfiler{
// filename -> records
std::map<std::string_view, std::vector<_LineRecord>> records;
stack_no_copy<_FrameRecord> frames;
std::set<FuncDecl*> functions;
void begin();
void _step(LinkedFrame*);
void _step_end(LinkedFrame*, int);
void end();
Str stats();
};
} // namespace pkpy