measuringringbuffer

package module
v0.0.0-...-c58975b Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: BSD-2-Clause Imports: 4 Imported by: 0

README

measuringringbuffer

GoDoc

This is a binary and library implementing a ring buffer of bytes that measures how much time is spend reading vs writing. The binary, fv (flowviewer) can be used instead of pv(1) to give more insight into where your bottleneck lies.

The output of the fv binary is expected to change in the future.

Documentation

Overview

Package measuringringbuffer copies data from a reader to a writer keeping track of how slow both are.

Each buffer should be used only once (one Copy or ReadFrom+WriteTo call). Most users should use the Copy API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

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

Buffer is a ring buffer that tracks stats about how much time is spent on reading vs writing.

func New

func New(size int) *Buffer

func (*Buffer) Copy

func (b *Buffer) Copy(w io.Writer, r io.Reader) (int64, error)

Copy data from the reader to the writer.

func (*Buffer) ReadFrom

func (b *Buffer) ReadFrom(r io.Reader) (int64, error)

func (*Buffer) Stats

func (b *Buffer) Stats() Stats

func (*Buffer) WriteTo

func (b *Buffer) WriteTo(w io.Writer) (int64, error)

type Stats

type Stats struct {
	BufferCapacity   int
	BufferedBytes    int
	BytesRead        int64
	TotalTime        time.Duration
	TimeSpentReading time.Duration
	TimeSpentWriting time.Duration
}

Stats are statistics of an active Buffer.

Directories

Path Synopsis
cmd
fv command
Binary fv uses measuringringbuffer to show how much time is spent reading vs writing.
Binary fv uses measuringringbuffer to show how much time is spent reading vs writing.

Jump to

Keyboard shortcuts

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