// MonitorBy 指定位置のインターフェースのアクティビティーモニター取得
182770
func (api *VPCRouterAPI) MonitorBy(id int64, nicIndex int, body *sacloud.ResourceMonitorRequest) (*sacloud.MonitorValues, error) {
	return api.baseAPI.applianceMonitorBy(id, "interface", nicIndex, body)
}
821784
func (api *CDROMAPI) FilterBy(key string, value interface{}) *CDROMAPI {
	api.filterBy(key, value, false)
	return api
}
1091720
func (api *SSHKeyAPI) FilterBy(key string, value interface{}) *SSHKeyAPI {
	api.filterBy(key, value, false)
	return api
}
1181113
func (m *Monitor) Status() Status {
	m.mu.Lock()
	now := m.update(0)
	s := Status{
		Active:   m.active,
		Start:    clockToTime(m.start),
		Duration: m.sLast - m.start,
		Idle:     now - m.tLast,
		Bytes:    m.bytes,
		Samples:  m.samples,
		PeakRate: round(m.rPeak),
		BytesRem: m.tBytes - m.bytes,
		Progress: percentOf(float64(m.bytes), float64(m.tBytes)),
	}
	if s.BytesRem < 0 {
		s.BytesRem = 0
	}
	if s.Duration > 0 {
		rAvg := float64(s.Bytes) / s.Duration.Seconds()
		s.AvgRate = round(rAvg)
		if s.Active {
			s.InstRate = round(m.rSample)
			s.CurRate = round(m.rEMA)
			if s.BytesRem > 0 {
				if tRate := 0.8*m.rEMA + 0.2*rAvg; tRate > 0 {
					ns := float64(s.BytesRem) / tRate * 1e9
					if ns > float64(timeRemLimit) {
						ns = float64(timeRemLimit)
					}
					s.TimeRem = clockRound(time.Duration(ns))
				}
			}
		}
	}
	m.mu.Unlock()
	return s
}
283678
func (api *IPv6NetAPI) FilterBy(key string, value interface{}) *IPv6NetAPI {
	api.filterBy(key, value, false)
	return api
}
638524
func newMonitor(ui cli.Ui, client *api.Client, length int) *monitor {
	if colorUi, ok := ui.(*cli.ColoredUi); ok {
		// Disable Info color for monitored output
		ui = &cli.ColoredUi{
			ErrorColor: colorUi.ErrorColor,
			WarnColor:  colorUi.WarnColor,
			InfoColor:  cli.UiColorNone,
			Ui:         colorUi.Ui,
		}
	}
	mon := &monitor{
		ui: &cli.PrefixedUi{
			InfoPrefix:   "==> ",
			OutputPrefix: "    ",
			ErrorPrefix:  "==> ",
			Ui:           ui,
		},
		client: client,
		state:  newEvalState(),
		length: length,
	}
	return mon
}
822699
func (api *IPAddressAPI) FilterBy(key string, value interface{}) *IPAddressAPI {
	api.filterBy(key, value, false)
	return api
}
1313186
func (_m *DBClient) GetProvisionWatcherByName(n string) (models.ProvisionWatcher, error) {
	ret := _m.Called(n)

	var r0 models.ProvisionWatcher
	if rf, ok := ret.Get(0).(func(string) models.ProvisionWatcher); ok {
		r0 = rf(n)
	} else {
		r0 = ret.Get(0).(models.ProvisionWatcher)
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string) error); ok {
		r1 = rf(n)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
813059
func (b *BigIP) PatchMonitor(name, monitorType string, config *Monitor) error {
	return b.patch(config, uriLtm, uriMonitor, monitorType, name)
}
749689
func RPCUnmonitor(m *monitor.Monitor) interface{} {
	return func(endpoint string) (bool, error) {
		if i, n := m.NodeByName(endpoint); i != -1 {
			m.Unmonitor(n)
			return true, nil
		}
		return false, errors.New("Cannot find node with that name")
	}
}
762081
func NewRegisterMonitor() *RegisterMonitor {
	var lock sync.Mutex
	return &RegisterMonitor{
		Logger:          log.New(os.Stderr, "", log.LstdFlags), // default logger
		ReconcilePeriod: RegisterReconcilePeriod,
		TTLPeriod:       RegisterTTLPeriod,
		lock:            &lock,
		cond:            sync.NewCond(&lock),
	}
}
1085060
func (cmd *Cmd) monitor() {
	err := cmd.Wait()
	if !cmd.stoppingValue.Load().(bool) {
		cmd.err = err
	}
	close(cmd.stopped)
}
515029
func (o *Application) Monitorscopes(info *bambou.FetchingInfo) (MonitorscopesList, *bambou.Error) {

	var list MonitorscopesList
	err := bambou.CurrentSession().FetchChildren(o, MonitorscopeIdentity, &list, info)
	return list, err
}
831163
func (p *ParallelManager) monitorProgress() {
	go func() {
		ticker := time.NewTicker(monitorPeriod)
		defer ticker.Stop()

		var prevSentBytes, maxBandwidth int64
		var retry int

		for {
			select {
			case <-p.stopMonitorCh:
				// Ordered to quit immediately
				return
			case <-ticker.C:
				// Compute new bandwidth from counted sent bytes
				sentBytes := atomic.LoadInt64(&p.sentBytes)
				bandwidth := sentBytes - prevSentBytes
				prevSentBytes = sentBytes

				if bandwidth <= maxBandwidth {
					retry++
					// We still want to add more workers
					// until we are sure that it is not
					// useful to add more of them.
					if retry > 2 {
						return
					}
				} else {
					retry = 0
					maxBandwidth = bandwidth
				}

				for i := 0; i < defaultWorkerFactor; i++ {
					p.addWorker()
				}
			}
		}
	}()
}
1096973
func NewMonitor(ctx context.Context, nPages int, agentPipe io.Reader, server1_0, server1_2 net.Listener) (m *Monitor, err error) {
	m = &Monitor{
		ctx:              ctx,
		listeners:        make(map[listener.MonitorListener]struct{}),
		nPages:           nPages,
		perfReaderCancel: func() {}, // no-op to avoid doing null checks everywhere
	}

	// start new MonitorListener handler
	go m.connectionHandler1_0(ctx, server1_0)
	go m.connectionHandler1_2(ctx, server1_2)

	// start agent event pipe reader
	go m.agentPipeReader(ctx, agentPipe)

	return m, nil
}
707188
func (p *grpcPeer) monitorStart() bool {
	select {
	// wait for start so we can be certain that we have a channel
	case <-p.t.once.Started():
		return true
	case <-p.stoppingC:
		return false
	}
}
602646
func Monitors() []*Monitor {
	var monitors []*Monitor
	mainthread.Call(func() {
		for _, monitor := range glfw.GetMonitors() {
			monitors = append(monitors, &Monitor{monitor: monitor})
		}
	})
	return monitors
}