add two paramaters about faststack

This commit is contained in:
obdev
2024-02-21 12:15:44 +00:00
committed by ob-robot
parent eb0df58ce0
commit 65f35839d3
6 changed files with 47 additions and 5 deletions

View File

@ -32,7 +32,20 @@ namespace oceanbase
namespace common
{
int64_t FASTSTACK_MIN_INTERVAL = 30 * 60 * 1000 * 1000; // 30min
ObSigFaststack::ObSigFaststack()
: min_interval_(30 * 60 * 1000 * 1000UL) // 30min
{
}
ObSigFaststack::~ObSigFaststack()
{
}
ObSigFaststack &ObSigFaststack::get_instance()
{
static ObSigFaststack sig_faststack;
return sig_faststack;
}
static const int SIG_SET[] = {SIGABRT, SIGBUS, SIGFPE, SIGSEGV, SIGURG};
static constexpr char MINICORE_SHELL_PATH[] = "tools/minicore.sh";
@ -268,7 +281,7 @@ int faststack()
int64_t now = ObTimeUtility::fast_current_time();
int64_t last = ATOMIC_LOAD(&last_ts);
int ret = OB_SUCCESS;
if (now - last < FASTSTACK_MIN_INTERVAL) {
if (now - last < ObSigFaststack::get_instance().get_min_interval()) {
ret = OB_EAGAIN;
} else if (!ATOMIC_BCAS(&last_ts, last, now)) {
ret = OB_EAGAIN;

View File

@ -21,6 +21,20 @@ namespace oceanbase
{
namespace common
{
class ObSigFaststack
{
public:
ObSigFaststack(const ObSigFaststack &) = delete;
ObSigFaststack& operator=(const ObSigFaststack &) = delete;
static ObSigFaststack &get_instance();
inline int64_t get_min_interval() const { return min_interval_; }
inline void set_min_interval(int64_t interval) { min_interval_ = interval; }
private:
ObSigFaststack();
~ObSigFaststack();
private:
int64_t min_interval_;
};
extern int minicoredump(int sig, int64_t tid, pid_t& pid);
extern int faststack();
} // namespace common