📄 reference.texi
字号:
@code{guint64}'s so we can save 128 signals there.@page@node glibtop_proc_kernel, glibtop_proc_segment, glibtop_proc_signal, System Dependent@subsection Process Kernel Data informationLibrary function @code{glibtop_get_proc_kernel}:@example@cartouchevoidglibtop_get_proc_kernel (glibtop_proc_kernel *buf, pid_t pid);voidglibtop_get_proc_kernel_l (glibtop *server, glibtop_proc_kernel *buf, pid_t pid);@end cartouche@end exampleDeclaration of @code{glibtop_proc_kernel} in @file{<glibtop/prockernel.h>}:@example@cartouchetypedef struct _glibtop_proc_kernel glibtop_proc_kernel;struct _glibtop_proc_kernel@{ guint64 flags; guint64 k_flags, min_flt, maj_flt, cmin_flt, cmaj_flt, kstk_esp, kstk_eip, nwchan; char wchan [40];@};@end cartouche@end example@table @code@item k_flagsKernel flags of the process. See the constants defined below.@item min_fltThe number of minor faults the process has made, those which have not requiredloading a memory page from disk.@item maj_fltThe number of major faults the process has made, those which have required loadinga memory page from disk.@item cmin_fltThe number of minor faults that the process and its children have made.@item cmaj_fltThe number of major faults that the process and its children have made.@item kstk_espThe current value of @code{esp} (32-bit stack pointer), as found in the kernel stackpage for the process.@item kstk_eipThe current @code{eip} (32-bit instruction pointer).@item nwchanThis is the "channel" in which the process is waiting. This is the address of a systemcall, and can be looked up in a namelist if you need a textual name.(If you have an up-to-date @file{/etc/psdatabase}, then try @code{ps -l} to see theWCHAN field in action).@item wchanThis is the textual name of the @code{nwchan} field.@end tableThere are some constants for the @code{k_flags} field:@example@cartouche#define GLIBTOP_KFLAGS_STARTING 1#define GLIBTOP_KFLAGS_EXITING 2#define GLIBTOP_KFLAGS_PTRACED 4#define GLIBTOP_KFLAGS_TRACESYS 8#define GLIBTOP_KFLAGS_FORKNOEXEC 16#define GLIBTOP_KFLAGS_SUPERPRIV 32#define GLIBTOP_KFLAGS_DUMPEDCORE 64#define GLIBTOP_KFLAGS_SIGNALED 128@end cartouche@end example@table @code@item GLIBTOP_KFLAGS_STARTINGProcess is being created.@item GLIBTOP_KFLAGS_EXITINGProcess is exiting.@item GLIBTOP_KFLAGS_PTRACEDProcess is being traced (via @code{ptrace ()}).@item GLIBTOP_KFLAGS_TRACESYSProcess is tracing system calls.@item GLIBTOP_KFLAGS_FORKNOEXECProcess @code{fork()}ed, but didn't @code{exec()} yet.@item GLIBTOP_KFLAGS_SUPERPRIVProcess used super-user privileges.@item GLIBTOP_KFLAGS_DUMPEDCOREProcess dumped core.@item GLIBTOP_KFLAGS_SIGNALEDProcess was killed by a signal.@end table@page@node glibtop_proc_segment, glibtop_proc_args, glibtop_proc_kernel, System Dependent@subsection Process Segment informationLibrary function @code{glibtop_get_proc_segment}:@example@cartouchevoidglibtop_get_proc_segment (glibtop_proc_segment *buf, pid_t pid);voidglibtop_get_proc_segment_l (glibtop *server, glibtop_proc_segment *buf, pid_t pid);@end cartouche@end exampleDeclaration of @code{glibtop_proc_segment} in @file{<glibtop/procsegment.h>}:@example@cartouchetypedef struct _glibtop_proc_segment glibtop_proc_segment;struct _glibtop_proc_segment@{ guint64 flags, text_rss, shlib_rss, data_rss, stack_rss, dirty_size, start_code, end_code, start_data, end_data, start_brk, end_brk, start_stack, start_mmap, arg_start, arg_end, env_start, env_end;@};@end cartouche@end example@table @code@item text_rssText resident set size@item shlib_rssShared-Lib resident set size@item data_rssData resident set size@item stack_rssStack resident set size@item dirty_sizeTotal size of dirty pages@item start_codeAddress of beginning of code segment@item end_codeAddress of end of code segment@item start_stackAddress of the bottom of stack segmen@end table@page@node glibtop_proc_args, glibtop_proc_map, glibtop_proc_segment, System Dependent@subsection Process ArgumentsLibrary function @code{glibtop_get_proc_args}:@example@cartouchechar *glibtop_get_proc_args_l (glibtop_proc_args *buf, pid_t pid, unsigned max_len);char *glibtop_get_proc_args_l (glibtop *server, glibtop_proc_args *buf, pid_t pid, unsigned max_len);@end cartouche@end exampleDeclaration of @code{glibtop_proc_args} in @file{<glibtop/procargs.h>}:@example@cartouchetypedef struct _glibtop_proc_args glibtop_proc_args;struct _glibtop_proc_args@{ guint64 flags, size;@};@end cartouche@end exampleReturns a string with all command line arguments of process @code{pid}(up to @code{max_len} characters, use zero to get all arguments).The command line arguments in the returned string are separated by zero bytes;the lenght of this string is returned in the @code{size} field.Remember to @code{g_free} the returned string to avoid a memory leak.@page@node glibtop_proc_map, glibtop_netload, glibtop_proc_args, System Dependent@subsection Process Memory MapsLibrary function @code{glibtop_get_proc_map}:@example@cartoucheglibtop_map_entry *glibtop_get_proc_map (glibtop_proc_map *buf, pid_t pid);glibtop_map_entry *glibtop_get_proc_map_l (glibtop *server, glibtop_proc_map *buf, pid_t pid);@end cartouche@end exampleDeclaration of @code{glibtop_proc_map} in @file{<glibtop/procmap.h>}:@example@cartouchetypedef struct _glibtop_proc_map glibtop_proc_map;struct _glibtop_proc_map@{ guint64 flags, number, total, size;@};@end cartouche@end exampleReturns a @code{glibtop_map_entry *} list (which needs to be freed with@code{g_free}) of memory maps of process @code{pid}.@table @code@item numberNumber of entries in the returned list.@item totalTotal size of the returned list (this equals @code{number * size}).@item sizeSize of a single entry in the returned list(this equals @code{sizeof (glibtop_map_entry)}).@end table@example@cartouchetypedef struct _glibtop_map_entry glibtop_map_entry;struct _glibtop_map_entry@{ guint64 flags, start, end, offset, perm, inode, device; char filename [GLIBTOP_MAP_FILENAME_LEN+1];@};@end cartouche@end exampleThe @code{flags} member is a bit field and specifies which of the otherfields are valid:@example@cartouche#define GLIBTOP_MAP_ENTRY_START 0#define GLIBTOP_MAP_ENTRY_END 1#define GLIBTOP_MAP_ENTRY_OFFSET 2#define GLIBTOP_MAP_ENTRY_PERM 3#define GLIBTOP_MAP_ENTRY_INODE 4#define GLIBTOP_MAP_ENTRY_DEVICE 5#define GLIBTOP_MAP_ENTRY_FILENAME 6@end cartouche@end exampleConstants for the @code{perm} member:@example@cartouche#define GLIBTOP_MAP_PERM_READ 1#define GLIBTOP_MAP_PERM_WRITE 2#define GLIBTOP_MAP_PERM_EXECUTE 4#define GLIBTOP_MAP_PERM_SHARED 8#define GLIBTOP_MAP_PERM_PRIVATE 16@end cartouche@end example@page@node glibtop_netload, glibtop_ppp, glibtop_proc_map, System Dependent@subsection Network LoadLibrary function @code{glibtop_get_netload}:@example@cartouchevoidglibtop_get_netload (glibtop_netload *buf, const char *interface);voidglibtop_get_netload_l (glibtop *server, glibtop_netload *buf, const char *interface);@end cartouche@end exampleDeclaration of @code{glibtop_netload} in @file{<glibtop/netload.h>}:@example@cartouchetypedef struct _glibtop_netload glibtop_netload;struct _glibtop_netload@{ guint64 flags, if_flags, mtu, subnet, address, packets_in, packets_out, packets_total, bytes_in, bytes_out, bytes_total, errors_in, errors_out, errors_total, collisions;@};@end cartouche@end exampleReturns network statistics for interface @code{interface} (which is the samethan in @code{ifconfig}).@table @code@item if_flagsInterface flags. See the contants defined below.@item mtuMaximum Transfer Unit (MTU)@item subnetSubnet Address@item addressInterface Address@item packets_inTotal number of incoming packets@item packets_outTotal number of outgoing packets@item packets_totalTotal number of packets@item bytes_inTotal number of incoming bytes@item bytes_outTotal number of outgoing bytes@item bytes_totalTotal number of bytes@item errors_inTotal number of errors in incoming direction@item errors_outTotal number of errors in outgoing direction@item errors_totalTotal number of errors@item collisionsTotal number of collisions@end tablePlease note that not all operating systems distinguish between incoming/outgoingbytes/packets/errors - in this case only the @samp{_total} fields are valid.Otherwise, they're just @samp{_in} plus @samp{_out}.Constants for @code{if_flags}:@example@cartoucheenum @{ GLIBTOP_IF_FLAGS_UP = 1, GLIBTOP_IF_FLAGS_BROADCAST, GLIBTOP_IF_FLAGS_DEBUG, GLIBTOP_IF_FLAGS_LOOPBACK, GLIBTOP_IF_FLAGS_POINTOPOINT, GLIBTOP_IF_FLAGS_RUNNING, GLIBTOP_IF_FLAGS_NOARP, GLIBTOP_IF_FLAGS_PROMISC, GLIBTOP_IF_FLAGS_ALLMULTI, GLIBTOP_IF_FLAGS_OACTIVE, GLIBTOP_IF_FLAGS_SIMPLEX, GLIBTOP_IF_FLAGS_LINK0, GLIBTOP_IF_FLAGS_LINK1, GLIBTOP_IF_FLAGS_LINK2, GLIBTOP_IF_FLAGS_ALTPHYS, GLIBTOP_IF_FLAGS_MULTICAST@};@end cartouche@end example@page@node glibtop_ppp, , glibtop_netload, System Dependent@subsection PPP StatisticsLibrary function @code{glibtop_get_ppp}:@example@cartouchevoidglibtop_get_ppp_l (glibtop *server, glibtop_ppp *buf, unsigned short device);voidglibtop_get_ppp (glibtop_ppp *buf, unsigned short device);@end cartouche@end exampleDeclaration of @code{glibtop_ppp} in @file{<glibtop/ppp.h>}:@example@cartouchetypedef struct _glibtop_ppp glibtop_ppp;struct _glibtop_ppp@{ guint64 flags, state, bytes_in, bytes_out;@};@end cartouche@end example@table @code@item bytes_inNumber of input bytes@item bytes_outNumber of output bytes@end tableThere are some constants for @code{state}:@example@cartoucheenum @{ GLIBTOP_PPP_STATE_UNKNOWN = 0, GLIBTOP_PPP_STATE_HANGUP, GLIBTOP_PPP_STATE_ONLINE@};@end cartouche
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -