Skip to content

Commit

Permalink
Merge pull request #158 from snprajwal/use-proto-names
Browse files Browse the repository at this point in the history
fix(crit): use snake_case names in `crit explore`
  • Loading branch information
rst0git committed Dec 28, 2023
2 parents d163ebf + 0634d78 commit 57bdacd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions crit/decode-extra.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ func decodeSkQueues(
}

type tcpStreamExtra struct {
InQ string `json:"inQ"`
OutQ string `json:"outQ"`
InQ string `json:"in_q"`
OutQ string `json:"out_q"`
}

// Extra data handler for TCP streams
Expand Down
34 changes: 17 additions & 17 deletions crit/explore.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (

// PsTree represents the process tree
type PsTree struct {
PID uint32 `json:"pId"`
PgID uint32 `json:"pgId"`
SID uint32 `json:"sId"`
PID uint32 `json:"pid"`
PgID uint32 `json:"pgid"`
SID uint32 `json:"sid"`
Comm string `json:"comm"`
Process *pstree.PstreeEntry `json:"-"`
Core *criu_core.CoreEntry `json:"-"`
Expand Down Expand Up @@ -70,8 +70,8 @@ func (c *crit) ExplorePs() (*PsTree, error) {

// Fd represents the file descriptors opened in a single process
type Fd struct {
PId uint32 `json:"pId"`
Files []*File `json:"files"`
PId uint32 `json:"pid"`
Files []*File `json:"files,omitempty"`
}

// File represents a single opened file
Expand Down Expand Up @@ -158,7 +158,7 @@ func (c *crit) ExploreFds() ([]*Fd, error) {

// MemMap represents the memory mapping of a single process
type MemMap struct {
PId uint32 `json:"pId"`
PId uint32 `json:"pid"`
Exe string `json:"exe"`
Mems []*Mem `json:"mems,omitempty"`
}
Expand Down Expand Up @@ -274,7 +274,7 @@ func (c *crit) ExploreMems() ([]*MemMap, error) {

// RssMap represents the resident set size mapping of a single process
type RssMap struct {
PId uint32 `json:"pId"`
PId uint32 `json:"pid"`
/*
walrus -> walruses
radius -> radii
Expand All @@ -286,8 +286,8 @@ type RssMap struct {

// Rss represents a single resident set size mapping
type Rss struct {
PhyAddr string `json:"phyAddr,omitempty"`
PhyPages int64 `json:"phyPages,omitempty"`
PhyAddr string `json:"phy_addr,omitempty"`
PhyPages int64 `json:"phy_pages,omitempty"`
Vmas []*Vma `json:"vmas,omitempty"`
Resource string `json:"resource,omitempty"`
}
Expand Down Expand Up @@ -376,24 +376,24 @@ func (c *crit) ExploreRss() ([]*RssMap, error) {

// Sk represents the sockets associated with a single process
type Sk struct {
PId uint32 `json:"pId"`
PId uint32 `json:"pid"`
Sockets []*Socket `json:"sockets"`
}

// Socket represents a single socket
type Socket struct {
Fd uint32 `json:"fd"`
FdType string `json:"fdType"`
FdType string `json:"fd_type"`
Family string `json:"family,omitempty"`
Protocol string `json:"protocol,omitempty"`
Type string `json:"type,omitempty"`
State string `json:"state,omitempty"`
SrcAddr string `json:"srcAddr,omitempty"`
SrcPort uint32 `json:"srcPort,omitempty"`
DestAddr string `json:"destAddr,omitempty"`
DestPort uint32 `json:"destPort,omitempty"`
SendBuf string `json:"sendBuf,omitempty"`
RecvBuf string `json:"recvBuf,omitempty"`
SrcAddr string `json:"src_addr,omitempty"`
SrcPort uint32 `json:"src_port,omitempty"`
DestAddr string `json:"dest_addr,omitempty"`
DestPort uint32 `json:"dest_port,omitempty"`
SendBuf string `json:"send_buf,omitempty"`
RecvBuf string `json:"recv_buf,omitempty"`
}

// ExploreSk searches the process tree for sockets
Expand Down

0 comments on commit 57bdacd

Please sign in to comment.