// Code generated by counterfeiter. DO NOT EDIT.
package rundmcfakes

import (
	"sync"

	"code.cloudfoundry.org/garden"
	"code.cloudfoundry.org/guardian/rundmc"
)

type FakeCPUCgrouper struct {
	CleanupCgroupsStub        func(string) error
	cleanupCgroupsMutex       sync.RWMutex
	cleanupCgroupsArgsForCall []struct {
		arg1 string
	}
	cleanupCgroupsReturns struct {
		result1 error
	}
	cleanupCgroupsReturnsOnCall map[int]struct {
		result1 error
	}
	PrepareCgroupsStub        func(string) error
	prepareCgroupsMutex       sync.RWMutex
	prepareCgroupsArgsForCall []struct {
		arg1 string
	}
	prepareCgroupsReturns struct {
		result1 error
	}
	prepareCgroupsReturnsOnCall map[int]struct {
		result1 error
	}
	ReadTotalCgroupUsageStub        func(string, garden.ContainerCPUStat) (garden.ContainerCPUStat, error)
	readTotalCgroupUsageMutex       sync.RWMutex
	readTotalCgroupUsageArgsForCall []struct {
		arg1 string
		arg2 garden.ContainerCPUStat
	}
	readTotalCgroupUsageReturns struct {
		result1 garden.ContainerCPUStat
		result2 error
	}
	readTotalCgroupUsageReturnsOnCall map[int]struct {
		result1 garden.ContainerCPUStat
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeCPUCgrouper) CleanupCgroups(arg1 string) error {
	fake.cleanupCgroupsMutex.Lock()
	ret, specificReturn := fake.cleanupCgroupsReturnsOnCall[len(fake.cleanupCgroupsArgsForCall)]
	fake.cleanupCgroupsArgsForCall = append(fake.cleanupCgroupsArgsForCall, struct {
		arg1 string
	}{arg1})
	stub := fake.CleanupCgroupsStub
	fakeReturns := fake.cleanupCgroupsReturns
	fake.recordInvocation("CleanupCgroups", []interface{}{arg1})
	fake.cleanupCgroupsMutex.Unlock()
	if stub != nil {
		return stub(arg1)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *FakeCPUCgrouper) CleanupCgroupsCallCount() int {
	fake.cleanupCgroupsMutex.RLock()
	defer fake.cleanupCgroupsMutex.RUnlock()
	return len(fake.cleanupCgroupsArgsForCall)
}

func (fake *FakeCPUCgrouper) CleanupCgroupsCalls(stub func(string) error) {
	fake.cleanupCgroupsMutex.Lock()
	defer fake.cleanupCgroupsMutex.Unlock()
	fake.CleanupCgroupsStub = stub
}

func (fake *FakeCPUCgrouper) CleanupCgroupsArgsForCall(i int) string {
	fake.cleanupCgroupsMutex.RLock()
	defer fake.cleanupCgroupsMutex.RUnlock()
	argsForCall := fake.cleanupCgroupsArgsForCall[i]
	return argsForCall.arg1
}

func (fake *FakeCPUCgrouper) CleanupCgroupsReturns(result1 error) {
	fake.cleanupCgroupsMutex.Lock()
	defer fake.cleanupCgroupsMutex.Unlock()
	fake.CleanupCgroupsStub = nil
	fake.cleanupCgroupsReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeCPUCgrouper) CleanupCgroupsReturnsOnCall(i int, result1 error) {
	fake.cleanupCgroupsMutex.Lock()
	defer fake.cleanupCgroupsMutex.Unlock()
	fake.CleanupCgroupsStub = nil
	if fake.cleanupCgroupsReturnsOnCall == nil {
		fake.cleanupCgroupsReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.cleanupCgroupsReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

func (fake *FakeCPUCgrouper) PrepareCgroups(arg1 string) error {
	fake.prepareCgroupsMutex.Lock()
	ret, specificReturn := fake.prepareCgroupsReturnsOnCall[len(fake.prepareCgroupsArgsForCall)]
	fake.prepareCgroupsArgsForCall = append(fake.prepareCgroupsArgsForCall, struct {
		arg1 string
	}{arg1})
	stub := fake.PrepareCgroupsStub
	fakeReturns := fake.prepareCgroupsReturns
	fake.recordInvocation("PrepareCgroups", []interface{}{arg1})
	fake.prepareCgroupsMutex.Unlock()
	if stub != nil {
		return stub(arg1)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *FakeCPUCgrouper) PrepareCgroupsCallCount() int {
	fake.prepareCgroupsMutex.RLock()
	defer fake.prepareCgroupsMutex.RUnlock()
	return len(fake.prepareCgroupsArgsForCall)
}

func (fake *FakeCPUCgrouper) PrepareCgroupsCalls(stub func(string) error) {
	fake.prepareCgroupsMutex.Lock()
	defer fake.prepareCgroupsMutex.Unlock()
	fake.PrepareCgroupsStub = stub
}

func (fake *FakeCPUCgrouper) PrepareCgroupsArgsForCall(i int) string {
	fake.prepareCgroupsMutex.RLock()
	defer fake.prepareCgroupsMutex.RUnlock()
	argsForCall := fake.prepareCgroupsArgsForCall[i]
	return argsForCall.arg1
}

func (fake *FakeCPUCgrouper) PrepareCgroupsReturns(result1 error) {
	fake.prepareCgroupsMutex.Lock()
	defer fake.prepareCgroupsMutex.Unlock()
	fake.PrepareCgroupsStub = nil
	fake.prepareCgroupsReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeCPUCgrouper) PrepareCgroupsReturnsOnCall(i int, result1 error) {
	fake.prepareCgroupsMutex.Lock()
	defer fake.prepareCgroupsMutex.Unlock()
	fake.PrepareCgroupsStub = nil
	if fake.prepareCgroupsReturnsOnCall == nil {
		fake.prepareCgroupsReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.prepareCgroupsReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

func (fake *FakeCPUCgrouper) ReadTotalCgroupUsage(arg1 string, arg2 garden.ContainerCPUStat) (garden.ContainerCPUStat, error) {
	fake.readTotalCgroupUsageMutex.Lock()
	ret, specificReturn := fake.readTotalCgroupUsageReturnsOnCall[len(fake.readTotalCgroupUsageArgsForCall)]
	fake.readTotalCgroupUsageArgsForCall = append(fake.readTotalCgroupUsageArgsForCall, struct {
		arg1 string
		arg2 garden.ContainerCPUStat
	}{arg1, arg2})
	stub := fake.ReadTotalCgroupUsageStub
	fakeReturns := fake.readTotalCgroupUsageReturns
	fake.recordInvocation("ReadTotalCgroupUsage", []interface{}{arg1, arg2})
	fake.readTotalCgroupUsageMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakeCPUCgrouper) ReadTotalCgroupUsageCallCount() int {
	fake.readTotalCgroupUsageMutex.RLock()
	defer fake.readTotalCgroupUsageMutex.RUnlock()
	return len(fake.readTotalCgroupUsageArgsForCall)
}

func (fake *FakeCPUCgrouper) ReadTotalCgroupUsageCalls(stub func(string, garden.ContainerCPUStat) (garden.ContainerCPUStat, error)) {
	fake.readTotalCgroupUsageMutex.Lock()
	defer fake.readTotalCgroupUsageMutex.Unlock()
	fake.ReadTotalCgroupUsageStub = stub
}

func (fake *FakeCPUCgrouper) ReadTotalCgroupUsageArgsForCall(i int) (string, garden.ContainerCPUStat) {
	fake.readTotalCgroupUsageMutex.RLock()
	defer fake.readTotalCgroupUsageMutex.RUnlock()
	argsForCall := fake.readTotalCgroupUsageArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakeCPUCgrouper) ReadTotalCgroupUsageReturns(result1 garden.ContainerCPUStat, result2 error) {
	fake.readTotalCgroupUsageMutex.Lock()
	defer fake.readTotalCgroupUsageMutex.Unlock()
	fake.ReadTotalCgroupUsageStub = nil
	fake.readTotalCgroupUsageReturns = struct {
		result1 garden.ContainerCPUStat
		result2 error
	}{result1, result2}
}

func (fake *FakeCPUCgrouper) ReadTotalCgroupUsageReturnsOnCall(i int, result1 garden.ContainerCPUStat, result2 error) {
	fake.readTotalCgroupUsageMutex.Lock()
	defer fake.readTotalCgroupUsageMutex.Unlock()
	fake.ReadTotalCgroupUsageStub = nil
	if fake.readTotalCgroupUsageReturnsOnCall == nil {
		fake.readTotalCgroupUsageReturnsOnCall = make(map[int]struct {
			result1 garden.ContainerCPUStat
			result2 error
		})
	}
	fake.readTotalCgroupUsageReturnsOnCall[i] = struct {
		result1 garden.ContainerCPUStat
		result2 error
	}{result1, result2}
}

func (fake *FakeCPUCgrouper) Invocations() map[string][][]interface{} {
	fake.invocationsMutex.RLock()
	defer fake.invocationsMutex.RUnlock()
	fake.cleanupCgroupsMutex.RLock()
	defer fake.cleanupCgroupsMutex.RUnlock()
	fake.prepareCgroupsMutex.RLock()
	defer fake.prepareCgroupsMutex.RUnlock()
	fake.readTotalCgroupUsageMutex.RLock()
	defer fake.readTotalCgroupUsageMutex.RUnlock()
	copiedInvocations := map[string][][]interface{}{}
	for key, value := range fake.invocations {
		copiedInvocations[key] = value
	}
	return copiedInvocations
}

func (fake *FakeCPUCgrouper) recordInvocation(key string, args []interface{}) {
	fake.invocationsMutex.Lock()
	defer fake.invocationsMutex.Unlock()
	if fake.invocations == nil {
		fake.invocations = map[string][][]interface{}{}
	}
	if fake.invocations[key] == nil {
		fake.invocations[key] = [][]interface{}{}
	}
	fake.invocations[key] = append(fake.invocations[key], args)
}

var _ rundmc.CPUCgrouper = new(FakeCPUCgrouper)
