Documentation
¶
Overview ¶
package shared contains things shared across tests and the various serialization protocols. This exists to prevent import cycles.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BasicMemInfoData []ShBasicMemInfo
Data for the benchmarks. All benchmarks operate off of the same set of randomly generated data.
var CPUInfoData []ShCPUInfo
var Formats []Format
Format holds a slice of serialization formats.
var Len int
The length of the slice holding the data structures.
var MemInfoData []ShMemInfo
var MessageData []ShMessage
var Ops []Op
Ops holds a slice of Op values. This allows consistency in ordering of output from Bench.Results.
var (
PadLen int = 2
)
Max Length of various types (for formatting purposes) and other formatting info
var RedditAccountData []ShRedditAccount
var StructTypes []StructType
StructTypes holds a slice of StructTypes.
Functions ¶
func GenBasicMemInfoData ¶
func GenBasicMemInfoData(l int)
GenBasicMemInfoData generates the random data for the BasicMemInfo struct. The resulting slice of structs will have l elements.
func GenMemInfoData ¶
func GenMemInfoData(l int)
GenMemInfoData generates the random data for the BasicMemInfo struct. The resulting slice of structs will have l elements.
func GenMessageData ¶
func GenMessageData(n, l int)
GenMessageData generates the random data for the Message struct whose data element being n bytes in length. The resulting slice of structs will have l elements.
func GenRedditAccountData ¶
func GenRedditAccountData(l int)
Types ¶
type AccountData ¶
type AccountData struct {
CommentKarma int64 `json:"comment_karma"`
HasMail bool `json:"has_mail"`
HasModMail bool `json:"has_mod_mail"`
ID string `json:"id"`
InboxCount int64 `json:"inbox_count"`
IsFriend bool `json:"is_friend"`
IsGold bool `json:"is_gold"`
LinkKarma int64 `json:"link_karma"`
ModHash string `json:"mod_hash"`
Name string `json:"name"`
Over18 bool `json:"over_18"`
}
type ShBasicMemInfo ¶
type ShBasicMemInfo struct {
MemTotal int64 `json:"mem_total"`
MemFree int64 `json:"mem_free"`
MemAvailable int64 `json:"mem_available"`
Buffers int64 `json:"buffers"`
Cached int64 `json:"cached"`
SwapCached int64 `json:"swap_cached"`
SwapTotal int64 `json:"swap_total"`
SwapFree int64 `json:"swap_free"`
}
type ShCPU ¶
type ShCPU struct {
Processor int16 `json:"processor"`
VendorID string `json:"vendor_id"`
CPUFamily string `json:"cpu_family"`
Model string `json:"model"`
ModelName string `json:"model_name"`
Stepping string `json:"stepping"`
Microcode string `json:"microcode"`
CPUMHz float32 `json:"cpu_mhz"`
CacheSize string `json:"cache_size"`
PhysicalID int16 `json:"physical_id"`
Siblings int16 `json:"siblings"`
CoreID int16 `json:"core_id"`
CPUCores int16 `json:"cpu_cores"`
ApicID int16 `json:"apicid"`
InitialApicID int16 `json:"initial_apicid"`
FPU string `json:"fpu"`
FPUException string `json:"fpu_exception"`
CPUIDLevel string `json:"cpuid_level"`
WP string `json:"wp"`
Flags string `json:"flags"`
BogoMIPS float32 `json:"bogomips"`
CLFlushSize string `json:"clflush_size"`
CacheAlignment string `json:"cache_alignment"`
AddressSizes string `json:"address_sizes"`
PowerManagement string `json:"power_management"`
}
type ShCPUInfo ¶
type ShCPUInfo struct {
CPUs []ShCPU `json:"cpu"`
}
func GenCPUInfoData ¶
n = number of cpus the data structure should have
type ShMemInfo ¶
type ShMemInfo struct {
MemTotal int64 `json:"mem_total"`
MemFree int64 `json:"mem_free"`
MemAvailable int64 `json:"mem_available"`
Buffers int64 `json:"buffers"`
Cached int64 `json:"cached"`
SwapCached int64 `json:"swap_cached"`
Active int64 `json:"active"`
Inactive int64 `json:"inactive"`
ActiveAnon int64 `json:"active_anon"`
InactiveAnon int64 `json:"inactive_anon"`
ActiveFile int64 `json:"active_file"`
InactiveFile int64 `json:"inactive_file"`
Unevictable int64 `json:"unevictable"`
Mlocked int64 `json:"mlocked"`
SwapTotal int64 `json:"swap_total"`
SwapFree int64 `json:"swap_free"`
Dirty int64 `json:"dirty"`
Writeback int64 `json:"writeback"`
AnonPages int64 `json:"anon_pages"`
Mapped int64 `json:"mapped"`
Shmem int64 `json:"sh_mem"`
Slab int64 `json:"slab"`
SReclaimable int64 `json:"s_reclaimable"`
SUnreclaim int64 `json:"s_unreclaim"`
KernelStack int64 `json:"kernel_stack"`
NFSUnstable int64 `json:"nfs_unstable"`
Bounce int64 `json:"bounce"`
WritebackTmp int64 `json:"writeback_tmp"`
CommitLimit int64 `json:"commit_limit"`
VmallocTotal int64 `json:"vmalloc_total"`
VmallocUsed int64 `json:"vmalloc_used"`
VmallocChunk int64 `json:"vmalloc_chunked"`
HardwareCorrupted int64 `json:"hardware_corrupted"`
AnonHugePages int64 `json:"anon_huge_pages"`
HugePagesTotal int64 `json:"huge_pages_total"`
HugePagesFree int64 `json:"huge_pages_free"`
HugePagesRsvd int64 `json:"huge_pages_rsvd"`
Hugepagesize int64 `json:"huge_pages_size"`
DirectMap4k int64 `json:"direct_map_4k"`
DirectMap2M int64 `json:"direct_map_2m"`
}
type ShRedditAccount ¶
type ShRedditAccount struct {
ID string `json:"id"`
Name string `json:"name"`
Kind string `json:"kind"`
Data AccountData `json:"data"`
}
type StructType ¶
type StructType int
const ( UnknownStruct StructType = iota BasicMemInfo MemInfo Message RedditAccount CPUInfo )
func (StructType) String ¶
func (i StructType) String() string