Documentation ¶
Overview ¶
Package uptime gets the current uptime from the /proc/uptime file. Instead of returning a Go struct, it returns JSON serialized bytes. A function to deserialize the JSON serialized bytes into an uptime.Uptime struct is provided.
Note: the package name is uptime and not the final element of the import path (json).
Index ¶
- func Deserialize(p []byte) (up u.Uptime, err error)
- func Get() (p []byte, err error)
- func Marshal(up u.Uptime) ([]byte, error)
- func NewTicker(d time.Duration) (joe.Tocker, error)
- func Serialize(up u.Uptime) (p []byte, err error)
- func Unmarshal(p []byte) (up u.Uptime, err error)
- type Profiler
- type Ticker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Deserialize ¶
Deserialize takes some JSON serialized bytes and unmarshals them as uptime.Uptime.
func Get ¶
Get gets the current uptime, /proc/uptime, as JSON serialized bytes using the package's global Profiler.
func NewTicker ¶
NewTicker returns a new Ticker containing a Data channel that delivers the data at intervals and an error channel that delivers any errors encountered. Stop the ticker to signal the ticker to stop running. Stopping the ticker does not close the Data channel; call Close to close both the ticker and the data channel.
Types ¶
type Profiler ¶
Profiler processes uptime information, /proc/uptime, using JSON.
func NewProfiler ¶
Returns an initialized Profiler; ready to use.