go-ethereum/common/debug/debug.go
SHIVAM SHARMA b1d86bd6ea
Shivam/txpool tracing (#604)
* lock, unlock to rlock, runlock

* add : tracing Pending() and Locals()

* Log time spent in committing a tx during mining

* Remove data from logging

* Move log into case where a tx completes without error

* profile fillTransactions

* fix conflict

* bug fixes

* add logs

* txpool: add tracing in Pending()

* rearrange tracing

* add attributes

* fix

* fix

* log error in profiling

* update file mode and file path for profiling

* full profiling

* fix log

* fix log

* less wait

* fix

* fix

* logs

* worker: use block number for prof files

* initial

* txList add

* fix gas calculation

* fix

* green tests

* linters

* prettify

* allocate less

* no locks between pending and reorg

* no locks

* no locks on locals

* more tests

* linters

* less allocs

* comment

* optimize errors

* linters

* fix

* fix

* Linters

* linters

* linters

* simplify errors

* atomics for transactions

* fix

* optimize workers

* fix copy

* linters

* txpool tracing

* linters

* fix tracing

* duration in mcs

* locks

* metrics

* fix

* cache hit/miss

* less locks on evict

* remove once

* remove once

* switch off pprof

* fix data race

* fix data race

* add : sealed total/empty blocks metric gauge

* add : RPC debug_getTraceStack

* fix : RPC debug_getTraceStack

* fix : RPC debug_getTraceStack for all go-routines

* linters

* add data race test on txpool

* fix concurrency

* noleak

* increase batch size

* prettify

* tests

* baseFee mutex

* panic fix

* linters

* fix gas fee data race

* linters

* more transactions

* debug

* debug

* fix ticker

* fix test

* add cacheMu

* more tests

* fix test panic

* linters

* add statistics

* add statistics

* txitems data race

* fix tx list Has

* fix : lint

Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>
2022-12-12 12:34:02 +05:30

52 lines
910 B
Go

package debug
import (
"fmt"
"runtime"
)
// Callers returns given number of callers with packages
func Callers(show int) []string {
fpcs := make([]uintptr, show)
n := runtime.Callers(2, fpcs)
if n == 0 {
return nil
}
callers := make([]string, 0, len(fpcs))
for _, p := range fpcs {
caller := runtime.FuncForPC(p - 1)
if caller == nil {
continue
}
callers = append(callers, caller.Name())
}
return callers
}
func CodeLine() (string, string, int) {
pc, filename, line, _ := runtime.Caller(1)
return runtime.FuncForPC(pc).Name(), filename, line
}
func CodeLineStr() string {
pc, filename, line, _ := runtime.Caller(1)
return fmt.Sprintf("%s:%d - %s", filename, line, runtime.FuncForPC(pc).Name())
}
func Stack(all bool) []byte {
buf := make([]byte, 4096)
for {
n := runtime.Stack(buf, all)
if n < len(buf) {
return buf[:n]
}
buf = make([]byte, 2*len(buf))
}
}