stats

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2015 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const STAT_BATCH_SIZE uint64 = 1 // batch 20 at one time before submit

Variables

View Source
var AllStats []Stats
View Source
var IN_WARMUP bool

Functions

func GetRunId

func GetRunId() string

func InitProfileStat

func InitProfileStat(h GetProfileCSVHeader, c GetProfileCSV)

func PrettyPrint

func PrettyPrint()

func SetNumWorker

func SetNumWorker(_w int)

func SetRunId

func SetRunId(_id string)

func SetSilent

func SetSilent(s bool)

Types

type DbStats

type DbStats struct {
	Db      string `bson:"db"`
	Objects string `bson:"objects"`

	AvgObjSize string `bson:"avgObjSize"`

	IndexSize string `bson:"indexSize"`

	IndexFileSize string `bson:"fileSize"` // index file size
}

type GetProfileCSV

type GetProfileCSV func(total_time float64) string // to return current profile's stats for CSV

type GetProfileCSVHeader

type GetProfileCSVHeader func() string // to return current profile's header for CSV

type MongoStats

type MongoStats struct {
	// contains filtered or unexported fields
}
var HammerMongoStats MongoStats

func (*MongoStats) CsvHeader

func (m *MongoStats) CsvHeader() string

func (*MongoStats) InitMongo_Monitor

func (m *MongoStats) InitMongo_Monitor(_server string, _dial_info mgo.DialInfo)

func (*MongoStats) MonitorMongo

func (m *MongoStats) MonitorMongo() (string, string)

type ProfileStats

type ProfileStats struct {
	Name string // profile stats shall have a name, which shall be title for csv & print
	// contains filtered or unexported fields
}

func (*ProfileStats) GetAvg

func (p *ProfileStats) GetAvg(total_time float64) float64

func (*ProfileStats) GetLastIntervalReq

func (p *ProfileStats) GetLastIntervalReq() int64

func (*ProfileStats) GetThroughput

func (p *ProfileStats) GetThroughput(total_time float64) float64

func (*ProfileStats) RecordResponse

func (p *ProfileStats) RecordResponse(t int64)

type Response

type Response map[string]interface{}

func (Response) String

func (r Response) String() (s string)

type ServerStatus

type ServerStatus struct {
	// "uptimeMillis" : NumberLong(701103909),
	Uptime       int64
	UptimeMillis int64 `bson:"uptimeMillis"`

	/*
		"connections" : {
			"current" : 4,
			"available" : 2044,
			"totalCreated" : NumberLong(6128)
		},
	*/
	Connections map[string]int
	/*
		"cursors" : {
			"totalOpen" : 0,
			"clientCursors_size" : 0,
			"timedOut" : 39
		},
	*/
	Cursors map[string]int

	/*
		"opcounters" : {
			"insert" : 137499268,
			"query" : 2664989,
			"update" : 31827171,
			"delete" : 0,
			"getmore" : 596,
			"command" : 107359317
		},
	*/
	Opcounters map[string]int

	/*
		"mem" : {
			"bits" : 64,
			"resident" : 4278,
			"virtual" : 36037,
			"supported" : true,
			"mapped" : 16729,
			"mappedWithJournal" : 33458
		},
	*/
	Mem map[string]int

	/*
		"extra_info" : {
			"note" : "fields vary by platform",
			"page_faults" : 4034466
		},
	*/
	Extra_info map[string]int

	/*
		"globalLock" : {
			"totalTime" : NumberLong("692055293000"),
			"lockTime" : NumberLong(1523335985),
			"currentQueue" : {
				"total" : 0,
				"readers" : 0,
				"writers" : 0
			},
			"activeClients" : {
				"total" : 0,
				"readers" : 0,
				"writers" : 0
			}
		},
	*/
	GlobalLock map[string]map[string]int `bson:"globalLock"`

	/*
		"backgroundFlushing" : {
			"flushes" : 7825,
			"total_ms" : 1295781,
			"average_ms" : 165.59501597444088,
			"last_ms" : 12017,
			"last_finished" : ISODate("2014-01-23T19:43:59.507Z")
		},
	*/
	BackgroundFlushing map[string]int `bson:"backgroundFlushing"`

	/*
		"indexCounters" : {
			"accesses" : 543179283,
			"hits" : 543179119,
			"misses" : 0,
			"resets" : 0,
			"missRatio" : 0
		},
	*/
	IndexCounters map[string]int

	/*
		"locks" : {
			"." : {    <-- global lock
				"timeLockedMicros" : {
					"R" : NumberLong(58871490),
					"W" : NumberLong(1344716751)
				},
				"timeAcquiringMicros" : {
					"R" : NumberLong(142669463),
					"W" : NumberLong(3293543)
				}
			},
			....
			"test1" : {    <-- per DB lock
				"timeLockedMicros" : {
					"r" : NumberLong(239821),
					"w" : NumberLong(73567)
				},
				"timeAcquiringMicros" : {
					"r" : NumberLong(81857),
					"w" : NumberLong(7573)
				}
			},
	*/
	Locks map[string]map[string]map[string]int64

	Host string
}

struct to hold serverStatus, this may not be ideal way to do this, TODO

type Shard

type Shard struct {
	Name    string `bson:"name"`
	Url     string `bson:"url"`
	Session *mgo.Session
}

struct for Shard

type ShardChunk

type ShardChunk struct {
	Id    string `bson:"_id"`
	Count int64  `bson:"count"`
}

type Stats

type Stats struct {
	C_response chan uint64
	C_send     chan uint64
	// contains filtered or unexported fields
}

Stats will be an atomic, to count the number of request handled

var HammerStats Stats

func (*Stats) RecordError

func (c *Stats) RecordError(worker_id int)

func (*Stats) RecordRes

func (c *Stats) RecordRes(_time uint64, method string, worker_id int)

increase the count and record response time.

func (*Stats) RecordSend

func (c *Stats) RecordSend(worker_id int) uint64

func (*Stats) StartMonitoring

func (c *Stats) StartMonitoring(monitor_channel *time.Ticker)

Jump to

Keyboard shortcuts

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