Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile hardware counters #85

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d149b52
skeleton of perf_bench_test
NiuJ1ao Nov 6, 2020
4340ba6
add TestBenchRequestPerSecond to bench
NiuJ1ao Nov 20, 2020
e44e762
Minor fix bench
NiuJ1ao Nov 20, 2020
027f656
Parallel boot VMs and minor fix bench TestBenchRequestPerSecond
NiuJ1ao Nov 25, 2020
689e1a3
change boot VMs back to sequential due to data race.
NiuJ1ao Nov 25, 2020
950a653
Add perf script that measures RPS benchmark
NiuJ1ao Nov 27, 2020
e52959b
remove flags from go test command
NiuJ1ao Dec 5, 2020
e6a5e10
update go.mod and go.sum
NiuJ1ao Dec 5, 2020
d9907c0
rebase perf_bench_test to master
NiuJ1ao Dec 5, 2020
c24dfc1
reproduce bash results by perf_profile
NiuJ1ao Dec 6, 2020
f9c6a97
Implement the skeleton of perf stat in golang and benchmark for multiVMs
NiuJ1ao Dec 12, 2020
3ffef26
remove redundant command from Makefile
NiuJ1ao Dec 17, 2020
af7d683
Refactor gperf.go, perf_profile.go and perf_bench_test.go
NiuJ1ao Dec 17, 2020
a9fbf1c
minor fix of log level
NiuJ1ao Dec 17, 2020
9d4c4b3
Restruct UI design and refactor perf_profile.go
NiuJ1ao Dec 22, 2020
05a77e3
Fix perf implementation and add tests for perf.go and plotter.go
NiuJ1ao Dec 31, 2020
d13b315
Set suitable images and corresponding RPS that stress CPU. Minor fix …
NiuJ1ao Jan 3, 2021
cfcc197
refactor main loop of perf_bench_test.go and let SetWarmTime do only …
NiuJ1ao Jan 4, 2021
6e27dd5
delete profile bash script
NiuJ1ao Jan 7, 2021
b949049
add unit test for running perf
NiuJ1ao Jan 7, 2021
1f97d02
change image names to vhiveease/
NiuJ1ao Jan 7, 2021
56b9cc7
add testing of the profile module to github actions
NiuJ1ao Jan 7, 2021
3be6fd2
remove created folders of TestBenchRequestPerSecond
NiuJ1ao Jan 14, 2021
756a756
minor fix calculation error and typo of variable names
NiuJ1ao Jan 14, 2021
40ec77b
minor fix conflict between filepath and filename format
NiuJ1ao Jan 14, 2021
d623088
remove shut down VMs and only boot VMs when necessary
NiuJ1ao Jan 14, 2021
e2f174a
minor fix to test replacement of characters
NiuJ1ao Jan 14, 2021
51b8a4a
change parameters of CSVPlotter to only accept file path and input fi…
NiuJ1ao Jan 16, 2021
bed2c69
split a function into logic pieces and another function uses these pi…
NiuJ1ao Jan 16, 2021
fae9877
Feature perf metrics: perf can automatically calculate metrics and pl…
NiuJ1ao Jan 16, 2021
8e57591
split NewPerfStat and readPerfData into function units
NiuJ1ao Jan 22, 2021
a478426
fix naming, descriptions and commits of running arguments and injecti…
NiuJ1ao Jan 22, 2021
3503253
merge profile test into unit test
NiuJ1ao Jan 22, 2021
e519565
change Y-axis to start from zero
NiuJ1ao Jan 22, 2021
b03905a
move metrics to PMU events map to JSON file, refactor parameters of c…
NiuJ1ao Jan 22, 2021
cb05a22
refactor perf profiler: split metrics into files and save interim res…
NiuJ1ao Feb 4, 2021
aa19be8
fix bug of incorrect step size on x-axis
NiuJ1ao Feb 4, 2021
c22b562
store metric to events map in json file
NiuJ1ao Feb 4, 2021
fbb4bc0
fix RPS calculation error, change profiler from perf to a PMU tool
NiuJ1ao Feb 4, 2021
cfde8bb
integrate PMU tool to benchmark
NiuJ1ao Feb 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor main loop of perf_bench_test.go and let SetWarmTime do only …
…once

Signed-off-by: NiuJ1ao <26167136+NiuJ1ao@users.noreply.github.com>
  • Loading branch information
NiuJ1ao committed Jan 22, 2021
commit cfcc197f2a310c90d5169555de32f9df12a73e9e
43 changes: 16 additions & 27 deletions perf_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestBenchMultiVMRequestPerSecond(t *testing.T) {
baseRPS := getCPUIntenseRPS()[*funcName]
*funcNames = *funcName

for i := 4; i <= 8; i += 4 {
for i := 4; i <= 20; i += 4 {
*vmNum = i
*targetReqPerSec = *vmNum * baseRPS
*funcNames = *funcName
Expand Down Expand Up @@ -110,43 +110,32 @@ func TestBenchRequestPerSecond(t *testing.T) {
avgExecTime, realRPS int64
vmGroup sync.WaitGroup
ticker = time.NewTicker(timeInterval)
tickerDone = make(chan bool, 1)
remainingRequests = totalRequests
warmupThreshold = totalRequests - *vmNum - 1
)

if isRunPerf {
err := perfStat.Run()
require.NoError(t, err, "Start perf stat returned error")
}

go func() {
for {
select {
case <-ticker.C:
vmGroup.Add(1)
remainingRequests--
if remainingRequests == warmupThreshold {
perfStat.SetWarmTime()
}

imageName := images[vmID%len(images)]
vmIDString := strconv.Itoa(vmID)

go serveVM(t, vmIDString, imageName, &vmGroup, isSyncOffload, &avgExecTime, &realRPS)

vmID = (vmID + 1) % *vmNum
case <-tickerDone:
ticker.Stop()
vmGroup.Wait()
return
for remainingRequests > 0 {
if tickerT := <-ticker.C; !tickerT.IsZero() {
vmGroup.Add(1)
remainingRequests--

imageName := images[vmID%len(images)]
vmIDString := strconv.Itoa(vmID)

go serveVM(t, vmIDString, imageName, &vmGroup, isSyncOffload, &avgExecTime, &realRPS)

vmID = (vmID + 1) % *vmNum
if vmID == 0 {
perfStat.SetWarmTime()
}
}
}()

for remainingRequests > 0 {
}
tickerDone <- true

ticker.Stop()
vmGroup.Wait()
perfStat.SetTearDownTime()

Expand Down
14 changes: 9 additions & 5 deletions profile/perf.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import (
"os/exec"
"strconv"
"strings"
"sync"
"time"

log "github.com/sirupsen/logrus"
)

// PerfStat A instance of perf stat command
type PerfStat struct {
once sync.Once
execTime float64
cmd *exec.Cmd
tStart time.Time
Expand Down Expand Up @@ -53,11 +55,13 @@ func (p *PerfStat) Run() error {

// SetWarmTime sets the time duration until system is warm.
func (p *PerfStat) SetWarmTime() {
p.warmTime = time.Since(p.tStart).Seconds()
p.once.Do(func() {
p.warmTime = time.Since(p.tStart).Seconds()

if p.warmTime > p.execTime {
log.Warn("System warmup time is longer than perf execution time.")
}
if p.execTime > 0 && p.warmTime > p.execTime {
log.Warn("System warmup time is longer than perf execution time.")
}
})
}

// SetTearDownTime sets the time duration until system tears down.
Expand Down Expand Up @@ -85,7 +89,7 @@ func (p *PerfStat) parseResult() (map[string]float64, error) {
return nil, err
}

// remove perf-tmp file
// remove temporary perf.data file
if err := os.Remove(p.outFile); err != nil {
return nil, err
}
Expand Down