Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: common/runtime/profiling/profiler.go

Issue 2644853005: Update project/service config references. (Closed)
Patch Set: Update project/service config references. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | logdog/api/config/svcconfig/util.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package profiling 5 package profiling
6 6
7 import ( 7 import (
8 "flag" 8 "flag"
9 "fmt" 9 "fmt"
10 "net" 10 "net"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 p.getLogger().Warningf("Failed to stop profile HTTP serv er: %s", err) 108 p.getLogger().Warningf("Failed to stop profile HTTP serv er: %s", err)
109 } 109 }
110 p.listener = nil 110 p.listener = nil
111 } 111 }
112 112
113 // Take one final snapshot. 113 // Take one final snapshot.
114 p.DumpSnapshot() 114 p.DumpSnapshot()
115 } 115 }
116 116
117 // DumpSnapshot dumps a profile snapshot to the configured output directory. If 117 // DumpSnapshot dumps a profile snapshot to the configured output directory. If
118 // no output directory is configured, nothing wil happen. 118 // no output directory is configured, nothing will happen.
119 func (p *Profiler) DumpSnapshot() error { 119 func (p *Profiler) DumpSnapshot() error {
120 if p.Dir == "" { 120 if p.Dir == "" {
121 return nil 121 return nil
122 } 122 }
123 123
124 if err := p.dumpHeapProfile(); err != nil { 124 if err := p.dumpHeapProfile(); err != nil {
125 return errors.Annotate(err).Reason("failed to dump heap profile" ).Err() 125 return errors.Annotate(err).Reason("failed to dump heap profile" ).Err()
126 } 126 }
127 return nil 127 return nil
128 } 128 }
(...skipping 22 matching lines...) Expand all
151 counter := atomic.AddUint32(&p.pathCounter, 1) - 1 151 counter := atomic.AddUint32(&p.pathCounter, 1) - 1
152 return filepath.Join(p.Dir, fmt.Sprintf("%s_%d_%d.prof", base, now.Unix( ), counter)) 152 return filepath.Join(p.Dir, fmt.Sprintf("%s_%d_%d.prof", base, now.Unix( ), counter))
153 } 153 }
154 154
155 func (p *Profiler) getLogger() logging.Logger { 155 func (p *Profiler) getLogger() logging.Logger {
156 if p.Logger != nil { 156 if p.Logger != nil {
157 return p.Logger 157 return p.Logger
158 } 158 }
159 return logging.Null 159 return logging.Null
160 } 160 }
OLDNEW
« no previous file with comments | « no previous file | logdog/api/config/svcconfig/util.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698