monitor

package
v0.0.0-...-ec7f410 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2014 License: MIT Imports: 3 Imported by: 2

Documentation

Overview

Package monitor implements an instrumentation interface.

Arbitrary functions can be profiled, and profile results are passed to the logger function (Monitor.Logger).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Duration

func Duration(f func()) time.Duration

Types

type Monitor

type Monitor struct {
	Stopwatch
	Logger func(section string, duration time.Duration)
}

func NewMonitor

func NewMonitor() *Monitor

func (*Monitor) Log

func (m *Monitor) Log(section string)

func (*Monitor) MonitorFunc

func (m *Monitor) MonitorFunc(section string, myfunc interface{}) []reflect.Value

Function decorator to monitor the execution of an anonymous function returns an array of the returned Values

func (*Monitor) MonitorFuncWithArgs

func (m *Monitor) MonitorFuncWithArgs(section string, myfunc interface{}, args []reflect.Value) []reflect.Value

func (*Monitor) MonitorReflectedFunc

func (m *Monitor) MonitorReflectedFunc(section string, reflectedFunc reflect.Value, args []reflect.Value) []reflect.Value

Function decorator to monitor a reflected function

func (*Monitor) StopAndLog

func (m *Monitor) StopAndLog(sectionName string) error

stop the stopwatch

type Section

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

type Stopwatch

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

func NewStopwatch

func NewStopwatch() Stopwatch

func (*Stopwatch) Duration

func (t *Stopwatch) Duration(sectionName string) (time.Duration, error)

func (*Stopwatch) Start

func (t *Stopwatch) Start(sectionName string) error

func (*Stopwatch) Stop

func (t *Stopwatch) Stop(sectionName string) error

Directories

Path Synopsis
Package monitor/db decorates database/sql drivers with query logging and timings
Package monitor/db decorates database/sql drivers with query logging and timings

Jump to

Keyboard shortcuts

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