sqllite

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FuncEdgeDB

type FuncEdgeDB struct {
	ID        uint      `gorm:"primarykey"` // 主键ID
	CreatedAt time.Time `gorm:"index"`      // 创建时间
	UpdatedAt time.Time // 更新时间
	CallerKey string    `gorm:"type:varchar(255);index"` // 调用方函数Key
	CalleeKey string    `gorm:"type:varchar(255);index"` // 被调用方函数Key
}

FuncEdgeDB 函数调用关系的数据库模型

func EdgefromMemModel

func EdgefromMemModel(edge *callgraph.FuncEdge) *FuncEdgeDB

type FuncNodeDB

type FuncNodeDB struct {
	ID        uint      `gorm:"primarykey"` // 主键ID
	CreatedAt time.Time `gorm:"index"`      // 创建时间
	UpdatedAt time.Time // 更新时间
	Key       string    `gorm:"type:varchar(255);unique"` // 函数唯一标识
	Pkg       string    `gorm:"type:varchar(255);index"`  // 包名
	Name      string    `gorm:"type:varchar(255)"`        // 函数名
}

FuncNodeDB 函数节点的数据库模型

func NodefromMemModel

func NodefromMemModel(node *callgraph.FuncNode) *FuncNodeDB

func (*FuncNodeDB) ToMemModel

func (f *FuncNodeDB) ToMemModel() *callgraph.FuncNode

添加从数据库模型转换回内存模型的方法

type FuncTree

type FuncTree struct {
	// contains filtered or unexported fields
}

func NewFuncNodeDB

func NewFuncNodeDB(dbPath string) (*FuncTree, error)

func (*FuncTree) Close

func (s *FuncTree) Close() error

Close 关闭数据库连接

func (*FuncTree) GetAllFuncEdges added in v1.1.0

func (s *FuncTree) GetAllFuncEdges() ([]*callgraph.FuncEdge, error)

GetAllFuncEdges 获取所有函数调用边

func (*FuncTree) GetAllFuncNodes added in v1.1.0

func (s *FuncTree) GetAllFuncNodes() ([]*callgraph.FuncNode, error)

GetAllFuncNodes 获取所有函数节点

func (*FuncTree) GetCalleeEdges

func (s *FuncTree) GetCalleeEdges(callerKey string) ([]*callgraph.FuncNode, error)

GetCalleeEdges 获取该函数调用的所有节点

func (*FuncTree) GetCallerEdges

func (s *FuncTree) GetCallerEdges(calleeKey string) ([]*callgraph.FuncNode, error)

GetCallerEdges 获取调用该函数的所有节点

func (*FuncTree) GetFuncNodeByKey

func (s *FuncTree) GetFuncNodeByKey(key string) (*callgraph.FuncNode, error)

GetFuncNodeByKey 根据Key获取函数节点

func (*FuncTree) InitTable added in v1.1.0

func (s *FuncTree) InitTable() error

func (*FuncTree) SaveFuncEdge

func (s *FuncTree) SaveFuncEdge(edge *callgraph.FuncEdge) error

SaveFuncEdge 保存函数调用关系

func (*FuncTree) SaveFuncNode

func (s *FuncTree) SaveFuncNode(node *callgraph.FuncNode) error

SaveFuncNode 保存函数节点

type TraceDB

type TraceDB struct {
	// contains filtered or unexported fields
}

func NewTraceDB

func NewTraceDB(dbPath string) (*TraceDB, error)

func (*TraceDB) Close

func (d *TraceDB) Close() error

func (*TraceDB) GetAllFunctionName

func (d *TraceDB) GetAllFunctionName() ([]string, error)

func (*TraceDB) GetAllGIDs

func (d *TraceDB) GetAllGIDs(page int, limit int) ([]uint64, error)

func (*TraceDB) GetAllParentIds added in v1.1.1

func (d *TraceDB) GetAllParentIds() ([]int64, error)

GetAllParentIds 获取所有的父函数ID

func (*TraceDB) GetChildFunctions added in v1.1.0

func (d *TraceDB) GetChildFunctions(parentId int64) ([]string, error)

GetChildFunctions 获取函数的子函数

func (*TraceDB) GetFunctionAnalysis added in v1.1.0

func (d *TraceDB) GetFunctionAnalysis(functionName string, queryType string) ([]entity.FunctionNode, error)

GetFunctionAnalysis 获取函数调用关系分析

func (*TraceDB) GetFunctionCallGraph added in v1.1.0

func (d *TraceDB) GetFunctionCallGraph(functionName string, depth int, direction string) (*entity.FunctionCallGraph, error)

GetFunctionCallGraph 获取函数调用关系图

func (*TraceDB) GetGidsByFunctionName

func (d *TraceDB) GetGidsByFunctionName(functionName string) ([]string, error)

func (*TraceDB) GetGoroutineCallDepth added in v1.1.0

func (d *TraceDB) GetGoroutineCallDepth(gid uint64) (int, error)

GetGoroutineCallDepth 获取指定 Goroutine 的最大调用深度

func (*TraceDB) GetGoroutineExecutionTime added in v1.1.0

func (d *TraceDB) GetGoroutineExecutionTime(gid uint64) (string, error)

func (*TraceDB) GetGoroutineStats added in v1.1.0

func (d *TraceDB) GetGoroutineStats() (*entity.GoroutineStats, error)

GetGoroutineStats 获取Goroutine统计信息

func (*TraceDB) GetHotFunctions added in v1.1.0

func (d *TraceDB) GetHotFunctions(sortBy string) ([]entity.HotFunction, error)

GetHotFunctions 获取热点函数分析数据

func (*TraceDB) GetInitialFunc

func (d *TraceDB) GetInitialFunc(gid uint64) (string, error)

func (*TraceDB) GetParamsByID

func (d *TraceDB) GetParamsByID(id int32) ([]functrace.TraceParams, error)

func (*TraceDB) GetTotalGIDs

func (d *TraceDB) GetTotalGIDs() (int, error)

func (*TraceDB) GetTracesByGID

func (d *TraceDB) GetTracesByGID(gid string) ([]entity.TraceData, error)

func (*TraceDB) GetTracesByParentId added in v1.1.1

func (d *TraceDB) GetTracesByParentId(parentId int64) ([]entity.TraceData, error)

GetTracesByParentId 根据父函数ID查询函数调用

func (*TraceDB) GetUnfinishedFunctions added in v1.1.1

func (d *TraceDB) GetUnfinishedFunctions(threshold int64) ([]entity.UnfinishedFunction, error)

GetUnfinishedFunctions 获取未完成的函数列表

func (*TraceDB) IsGoroutineFinished added in v1.1.1

func (d *TraceDB) IsGoroutineFinished(gid uint64) (bool, error)

IsGoroutineFinished 检查指定的goroutine是否已完成 判断依据:如果一个goroutine中所有indent=0的函数都有timeCost值,则认为该goroutine已完成

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL