func New(logger log.Logger, analysisPool *analysis.Pool, interval time.Duration, cumulative bool, statProvider StatProvider,
	useTermbox bool, topX uint16, minKeySizeThreshold uint64, outputFile string) UIHandler {
	return &uiContext{
		logger:              logger,
		analysis:            analysisPool,
		interval:            interval,
		statProvider:        statProvider,
		msgChan:             make(chan string, 128),
		prevReport:          analysis.Report{},
		cumulative:          cumulative,
		paused:              false,
		useTermbox:          useTermbox,
		topX:                topX,
		minKeySizeThreshold: minKeySizeThreshold,
		outputFile:          outputFile,
	}
}
New returns a UIHandler that is ready to run
package presentation
import (
	"fmt"
	"github.com/box/memsniff/analysis"
	"github.com/box/memsniff/log"
	"time"
)
type UIHandler interface {
	Run() error
	Log(items ...interface{})
}
type uiContext struct {
	logger              log.Logger
	analysis            *analysis.Pool
	interval            time.Duration
	statProvider        StatProvider
	messages            []string
	msgChan             chan string
	prevReport          analysis.Report
	cumulative          bool
	paused              bool
	useTermbox          bool
	topX                uint16
	minKeySizeThreshold uint64
	outputFile          string
}
type StatsSet struct {
	Culumative  *Stats
	Incremental *Stats
}
type Stats struct {
	PacketsEnteredFilter int `json:"PacketsEnteredFilter"`
	PacketsPassedFilter int `json:"PacketsPassedFilter"`
	PacketsCaptured int `json:"PacketsCaptured"`
	PacketsDroppedKernel int `json:"PacketsDroppedKernel"`
	PacketsDroppedParser int `json:"PacketsDroppedParser"`
	PacketsDroppedAnalysis int `json:"PacketsDroppedAnalysis"`
	PacketsDroppedTotal    int `json:"PacketsDroppedTotal"`
	ResponsesParsed        int `json:"ResponsesParsed"`
}
func (s Stats) Diff(other Stats) Stats {
	newStats := s
	newStats.PacketsEnteredFilter = s.PacketsEnteredFilter - other.PacketsEnteredFilter
	newStats.PacketsPassedFilter = s.PacketsPassedFilter - other.PacketsPassedFilter
	newStats.PacketsCaptured = s.PacketsCaptured - other.PacketsCaptured
	newStats.PacketsDroppedKernel = s.PacketsDroppedKernel - other.PacketsDroppedKernel
	newStats.PacketsDroppedParser = s.PacketsDroppedParser - other.PacketsDroppedParser
	newStats.PacketsDroppedAnalysis = s.PacketsDroppedAnalysis - other.PacketsDroppedAnalysis
	newStats.PacketsDroppedTotal = s.PacketsDroppedTotal - other.PacketsDroppedTotal
	newStats.ResponsesParsed = s.ResponsesParsed - other.ResponsesParsed
	return newStats
}
type StatProvider func() StatsSet