此内容没有您所选择的语言版本。
9.8. Formatting functions
The following functions help you format output.
9.8.1. ctime 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
General syntax:
ctime:string(epochsecs:long)
ctime:string(epochsecs:long)
This function accepts an argument of seconds since the epoch as returned by
gettimeofday_s()
. It returns a date string in UTC of the form:
"Wed Jun 30 21:49:008 2006"
"Wed Jun 30 21:49:008 2006"
This function does not adjust for timezones. The returned time is always in GMT. Your script must manually adjust epochsecs before passing it to ctime() if you want to print local time.
9.8.2. errno_str 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
General syntax:
errno_str:string (err:long)
errno_str:string (err:long)
This function returns the symbolic string associated with the given error code, such as ENOENT for the number 2, or E#3333 for an out-of-range value such as 3333.
9.8.3. returnstr 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
General syntax:
returnstr:string (returnp:long)
returnstr:string (returnp:long)
This function is used by the syscall tapset, and returns a string. Set returnp equal to 1 for decimal, or 2 for hex.
9.8.4. thread_indent 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
General syntax:
thread_indent:string (delta:long)
thread_indent:string (delta:long)
This function returns a string with appropriate indentation for a thread. Call it with a small positive or matching negative delta. If this is the outermost, initial level of indentation, then the function resets the relative timestamp base to zero.
The following example uses thread_indent() to trace the functions called in the drivers/usb/core kernel source. It prints a relative timestamp and the name and ID of the current process, followed by the appropriate indent and the function name. Note that "swapper(0)" indicates the kernel is running in interrupt context and there is no valid current process.
This prints:
9.8.5. thread_timestamp 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
General syntax:
thread_timestamp:long ()
thread_timestamp:long ()
This function returns an absolute timestamp value for use by the indentation function. The default function uses
gettimeofday_us.