Skip to content

Commit

Permalink
style comments
Browse files Browse the repository at this point in the history
Signed-off-by: Plamen Petrov <plamb0brt@gmail.com>
  • Loading branch information
plamenmpetrov committed Aug 13, 2020
1 parent c8fc4cb commit d0b6708
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion memory/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ func (m *MemoryManager) Activate(vmID string, userFaultFDFile *os.File) (err err
state.isActive = true
state.isEverActivated = true
state.firstPageFaultOnce = new(sync.Once)
state.servedNum = 0
state.quitCh = make(chan int)

if state.metricsModeOn {
state.uniqueNum = 0
state.servedNum = 0
state.currentMetric = metrics.NewMetric()
}

Expand Down
15 changes: 7 additions & 8 deletions memory/manager/snapshot_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,11 @@ func (s *SnapshotState) pollUserPageFaults(readyCh chan int) {
if s.isRecordReady && !s.IsLazyMode {
if s.metricsModeOn {
tStart = time.Now()
s.fetchState()
}
s.fetchState()
if s.metricsModeOn {
s.currentMetric.MetricMap["FetchState"] = metrics.ToUS(time.Since(tStart))
} else {
s.fetchState()
}

}
// }

Expand Down Expand Up @@ -302,7 +301,7 @@ func (s *SnapshotState) pollUserPageFaults(readyCh chan int) {
func (s *SnapshotState) servePageFault(fd int, address uint64) error {
var (
tStart time.Time
serveUnique string = "ServeUnique"
serveUnique = "ServeUnique"
workingSetInstalled bool
)

Expand All @@ -314,11 +313,11 @@ func (s *SnapshotState) servePageFault(fd int, address uint64) error {
if s.isRecordReady && !s.IsLazyMode {
if s.metricsModeOn {
tStart = time.Now()
s.installWorkingSetPages(fd)
}
s.installWorkingSetPages(fd)
if s.metricsModeOn {
s.currentMetric.MetricMap["InstallWS"] = metrics.ToUS(time.Since(tStart))
s.currentMetric.MetricMap[serveUnique] = float64(0)
} else {
s.installWorkingSetPages(fd)
}

workingSetInstalled = true
Expand Down

0 comments on commit d0b6708

Please sign in to comment.