Documentation
¶
Index ¶
- Constants
- Variables
- func Bts2Str(bts []byte) string
- func CheckIfUseLCSByIdc(idc string) bool
- func ConvertToInt64(v interface{}) (int64, error)
- func CopyFile(src, dst string) (err error)
- func CpuProfiling(s int64)
- func CutStringSliceByStep(array []string, step int) (int, [][]string)
- func DGetCurrentTime(layout string) string
- func DeferAppStat(appid uint32, b time.Time, err **dogErr.CodeError)
- func DeferStat(b time.Time, err **dogErr.CodeError)
- func Dump(fileDir, name string) (*os.File, error)
- func Duration(d int64) time.Duration
- func EnsureDir(dir string) error
- func Exists(p string) bool
- func FixCategoryByIdc(idc, category string) string
- func FormatMemStats(m1, m2 *runtime.MemStats) string
- func FromLocalDateToSecond(v string) int64
- func FromSecondToLocalDate(v int64) string
- func FromTime2TimeInt(t time.Time) int
- func FuncName(skip int) string
- func GcStats() string
- func GetCurrentMicrosecond() int64
- func GetCurrentMillisecond() int64
- func GetCurrentNanosecond() int64
- func GetCurrentSecond() int64
- func GetCurrentTime() string
- func HumanSize(s uint64) string
- func Int64ArraySlice(array []int64, offset int, length int) []int64
- func Int64ArrayToString(list []int64, sep string) string
- func IsEmpty(dir string) (bool, error)
- func IsLink(p string) (bool, error)
- func IsSameDay(t1, t2 time.Time) bool
- func IsSameDayWithTimestamp(d1, d2 int64) bool
- func ListDir(dir string) ([]string, error)
- func LoadJsonToObject(filename string, t interface{}) error
- func Marshal(v interface{}) ([]byte, error)
- func MemStats() string
- func MemStats2() string
- func MustFloat64(v interface{}, defaultValue float64) float64
- func MustInt64(v interface{}, defaultValue int64) int64
- func MustInt64Array(v interface{}, defaultValue []int64) []int64
- func MustString(v interface{}, defaultValue string) string
- func MustStringArray(v interface{}, defaultValue []string) []string
- func ParseMemorySize(size string) (uint64, error)
- func PathExists(path string) bool
- func RandString(n int) string
- func ReviewDumpPanic(file *os.File) error
- func RuntimeStats(d time.Duration, f func(string))
- func SafeSprintf(format string, args ...interface{}) string
- func Sleep(millisecond int64)
- func SliceCutter(v interface{}, maxsize int) ([]interface{}, error)
- func SplitTimeInt(t int) (year, month, day int)
- func Store2File(file string, content string) error
- func Str2Bts(str string) []byte
- func StringArraySlice(array []string, offset int, length int) []string
- func StringStringMap2StringInterfaceMap(input map[string]string) map[string]interface{}
- func TraceId() string
- func TryString(v interface{}) (string, bool)
- func WithRecover(fn func(), errHandler func(interface{})) (err interface{})
- func WriteBlock()
- func WriteGoroutine()
- func WriteHeap()
- func WriteMutex()
- func WriteThreadCreate()
- type DeployFunc
- type FindFunc
- type FixedGoroutinePool
- type FixedGoroutinePoolTimeout
- type GoRoutinePoolWithConfig
- type Helper
- type PerfFunc
- type Stat
- type StatMgr
- type StatValue
- type StatusFunc
- type StopableTask
- type StopableTaskGroup
- type UpdateFunc
Constants ¶
View Source
const ( Nanosecond = int64(time.Nanosecond) // Nanosecond Microsecond = 1000 * Nanosecond // Nanosecond Millisecond = 1000 * Microsecond // Nanosecond Second = 1000 * Millisecond // Nanosecond Minute = 60 * Second // Nanosecond Hour = 60 * Minute // Nanosecond Day = 24 * Hour // Nanosecond Year = 365 * Day // Nanosecond SecondsPerYear = Year / Second // Second SecondsPerDay = Day / Second // Second SecondsPerHour = Hour / Second // Second SecondsPerMinute = Minute / Second // Second MillisecondsPerYear = Year / Millisecond // Millisecond MillisecondsPerDay = Day / Millisecond // Millisecond MillisecondsPerHour = Hour / Millisecond // Millisecond MillisecondsPerMinute = Minute / Millisecond // Millisecond MillisecondsPerSecond = Second / Millisecond // Millisecond MicrosecondsPerYear = Year / Microsecond // Microsecond MicrosecondsPerDay = Day / Microsecond // Microsecond MicrosecondsPerHour = Hour / Microsecond // Microsecond MicrosecondsPerMinute = Minute / Microsecond // Microsecond MicrosecondsPerSecond = Second / Microsecond // Microsecond MicrosecondsPerMillisecond = Millisecond / Microsecond // Microsecond )
View Source
const MaxStatFileCount = 10
View Source
const MaxStatFileSize = 100 * 1024 * 1024
View Source
const ProfDumpBackupDir = "./prof"
View Source
const ProfDumpDir = "prof"
Variables ¶
View Source
var TIMTOUR_Err = fmt.Errorf("insert into gouroutine pool timeout")
Functions ¶
func ConvertToInt64 ¶
func CopyFile ¶
CopyFile copies a file from src to dst. If src and dst files exist, and are the same, then return success. copy the file contents from src to dst.
func CpuProfiling ¶
func CpuProfiling(s int64)
func CutStringSliceByStep ¶
return subslice count and subslices
func DGetCurrentTime ¶
func FixCategoryByIdc ¶
LCS服务为防止无法寻找到topic,需要对category添加前缀
func FormatMemStats ¶
func FromLocalDateToSecond ¶
func FromSecondToLocalDate ¶
func FromTime2TimeInt ¶
func GetCurrentMicrosecond ¶
func GetCurrentMicrosecond() int64
func GetCurrentMillisecond ¶
func GetCurrentMillisecond() int64
func GetCurrentNanosecond ¶
func GetCurrentNanosecond() int64
func GetCurrentSecond ¶
func GetCurrentSecond() int64
func GetCurrentTime ¶
func GetCurrentTime() string
func Int64ArrayToString ¶
func IsSameDayWithTimestamp ¶
func LoadJsonToObject ¶
func MustFloat64 ¶
func MustInt64Array ¶
func MustString ¶
func MustStringArray ¶
func PathExists ¶
func RandString ¶
func ReviewDumpPanic ¶
func RuntimeStats ¶
get runtime stats,contained goroutine numbers,gc pause,heap objects,heap alloc and malloc
func SafeSprintf ¶
TODO://解决参数类型不对的问题,以及%.2f类似问题
func SliceCutter ¶
func SplitTimeInt ¶
func Store2File ¶
func StringStringMap2StringInterfaceMap ¶
This is a safe convert since string can always convert to interface{}
func WithRecover ¶
func WithRecover(fn func(), errHandler func(interface{})) (err interface{})
func WriteBlock ¶
func WriteBlock()
func WriteGoroutine ¶
func WriteGoroutine()
func WriteMutex ¶
func WriteMutex()
func WriteThreadCreate ¶
func WriteThreadCreate()
Types ¶
type DeployFunc ¶
type FixedGoroutinePool ¶
type FixedGoroutinePool struct {
Size int64
// contains filtered or unexported fields
}
func (*FixedGoroutinePool) Close ¶
func (f *FixedGoroutinePool) Close()
func (*FixedGoroutinePool) Execute ¶
func (f *FixedGoroutinePool) Execute(function func())
func (*FixedGoroutinePool) ExecuteWithArg ¶
func (f *FixedGoroutinePool) ExecuteWithArg(function func(args ...interface{}), arg ...interface{})
func (*FixedGoroutinePool) Start ¶
func (f *FixedGoroutinePool) Start() error
type FixedGoroutinePoolTimeout ¶
type FixedGoroutinePoolTimeout struct {
Size int64
Timeout time.Duration
// contains filtered or unexported fields
}
func (*FixedGoroutinePoolTimeout) Close ¶
func (f *FixedGoroutinePoolTimeout) Close()
func (*FixedGoroutinePoolTimeout) Execute ¶
func (f *FixedGoroutinePoolTimeout) Execute(function func()) error
func (*FixedGoroutinePoolTimeout) Start ¶
func (f *FixedGoroutinePoolTimeout) Start() error
type GoRoutinePoolWithConfig ¶
type GoRoutinePoolWithConfig struct {
DefaultSize int64
ReservedConfig map[string]int64
// contains filtered or unexported fields
}
func (*GoRoutinePoolWithConfig) Close ¶
func (g *GoRoutinePoolWithConfig) Close()
func (*GoRoutinePoolWithConfig) ExecuteDefault ¶
func (g *GoRoutinePoolWithConfig) ExecuteDefault(function func())
func (*GoRoutinePoolWithConfig) ExecuteKey ¶
func (g *GoRoutinePoolWithConfig) ExecuteKey(key string, function func())
func (*GoRoutinePoolWithConfig) Start ¶
func (g *GoRoutinePoolWithConfig) Start() error
type Helper ¶
type Helper struct {
Host string
Updater UpdateFunc
Finder FindFunc
Perfer PerfFunc
Stater StatusFunc
Deployer DeployFunc
// contains filtered or unexported fields
}
type Stat ¶
type Stat struct {
// contains filtered or unexported fields
}
func (*Stat) BeginFuncCmdAt ¶
BeginFuncCmdAt use funcName as cmd but set begin
type StatMgr ¶
type StatMgr struct {
// contains filtered or unexported fields
}
func StatMgrInstance ¶
func StatMgrInstance() *StatMgr
type StatusFunc ¶
type StatusFunc func() string
type StopableTask ¶
type StopableTask interface {
Close()
}
* Notice: 1. it use lock to make sure taskList is correct. performance is bad 2. still able to add task after WaitStopAll, so you should make sure no extra task is running after called WaitStopAll
type StopableTaskGroup ¶
type StopableTaskGroup struct {
// contains filtered or unexported fields
}
func NewStopableTaskGroup ¶
func NewStopableTaskGroup() *StopableTaskGroup
func (*StopableTaskGroup) AddTask ¶
func (s *StopableTaskGroup) AddTask(task StopableTask)
func (*StopableTaskGroup) Close ¶
func (s *StopableTaskGroup) Close()
func (*StopableTaskGroup) Start ¶
func (s *StopableTaskGroup) Start() error
func (*StopableTaskGroup) WaitStopAll ¶
func (s *StopableTaskGroup) WaitStopAll()
type UpdateFunc ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.