mirror of
https://github.com/ossrs/srs.git
synced 2025-02-13 03:41:55 +00:00
Support gdb/srs.py to stat coroutines. 4.0.44
This commit is contained in:
parent
8c1eca98b0
commit
71c9732bff
3 changed files with 32 additions and 1 deletions
|
@ -155,6 +155,7 @@ For previous versions, please read:
|
|||
|
||||
## V4 changes
|
||||
|
||||
* v4.0, 2020-10-31, Support gdb/srs.py to stat coroutines. 4.0.44
|
||||
* v4.0, 2020-09-19, RTC: Extract resource manager. Use any UDP packet to keep alive. 4.0.43
|
||||
* v4.0, 2020-09-09, RTC: Refine NACK RTT and efficiency. 4.0.42
|
||||
* v4.0, 2020-09-08, Refine PLI/NACK/DTLS logs. 4.0.41
|
||||
|
|
30
trunk/gdb/srs.py
Normal file
30
trunk/gdb/srs.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
import gdb, sys, traceback;
|
||||
|
||||
class NnCouroutines(gdb.Command):
|
||||
def __init__(self):
|
||||
super(NnCouroutines, self).__init__('nn_coroutines', gdb.COMMAND_DATA)
|
||||
|
||||
def invoke(self, arg, from_tty):
|
||||
try:
|
||||
if len(arg) > 0:
|
||||
prev = pthis = arg
|
||||
print('start from %s'%(arg))
|
||||
else:
|
||||
prev = pthis = gdb.parse_and_eval('&_st_this_thread->tlink').__str__()
|
||||
print('start from &_st_this_thread->tlink')
|
||||
print('first is: %s'%(pthis))
|
||||
nn_coroutines, pnext = 1, pthis
|
||||
while True:
|
||||
v = gdb.parse_and_eval('((_st_clist_t*)%s)->next'%pnext)
|
||||
prev = pnext = str(v.__str__()).split(' ')[0]
|
||||
if pnext == pthis:
|
||||
break
|
||||
nn_coroutines += 1
|
||||
if len(arg) > 0 or (nn_coroutines%1000) == 0:
|
||||
print('next is %s, total %s'%(pnext, nn_coroutines))
|
||||
print('total coroutines: %s'%(nn_coroutines))
|
||||
except:
|
||||
print('Error: prev=%s, this=%s, next=%s, v=%s'%(prev, pthis, pnext, v))
|
||||
traceback.print_exc()
|
||||
|
||||
NnCouroutines()
|
|
@ -24,6 +24,6 @@
|
|||
#ifndef SRS_CORE_VERSION4_HPP
|
||||
#define SRS_CORE_VERSION4_HPP
|
||||
|
||||
#define SRS_VERSION4_REVISION 43
|
||||
#define SRS_VERSION4_REVISION 44
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue