提交 b7db2189 编写于 作者: K Kweku Adams

Fixing some issues in the setup script.

Also addressing some style guide issues.

Change-Id: Ibb87482c106ea7127ad4e1896e692a47af71326e
上级 e4502544
......@@ -68,7 +68,8 @@ $ adb bugreport > bugreport.txt
### Start analyzing!
You are all set now. Run `historian` and visit <http://localhost:9999> and upload the `bugreport.txt` file to start analyzing.
You are all set now. Run `historian` and visit <http://localhost:9999> and
upload the `bugreport.txt` file to start analyzing.
## Screenshots
......@@ -188,7 +189,8 @@ $ stop monsoon.py
##### Modifying the proto files
If you want to modify the proto files (pb/\*/\*.proto), first download the additional tools necessary:
If you want to modify the proto files (pb/\*/\*.proto), first download the
additional tools necessary:
Install the standard C++ implementation of protocol buffers from <https://github.com/google/protobuf/blob/master/src/README.md>
......
......@@ -76,7 +76,11 @@ func RunCommand(name string, args ...string) (string, error) {
// Run the script.
if err := cmd.Run(); err != nil {
return "", fmt.Errorf("failed to run command: %v -- %s", err, stderr)
c := name
if len(args) > 0 {
c += " " + strings.Join(args, " ")
}
return "", fmt.Errorf("failed to run command %q:\n %v\n %s", c, err, stderr.String())
}
return stdout.String(), nil
......
......@@ -100,7 +100,8 @@ var testPowermonitorConfig = function() {
var header = 'metric,type,start_time,end_time,value,opt\n';
// Non default y domain.
data = historian.data.processHistorianV2Data(
header + 'Powermonitor,int,1000,2000,-10,\n' + 'Powermonitor,int,2000,3000,1001,\n',
header + 'Powermonitor,int,1000,2000,-10,\n' +
'Powermonitor,int,2000,3000,1001,\n',
2300, {}, '', true);
assertObjectEquals({min: -10, max: 1001},
data.configs.getConfig(data.defaultLevelMetric).yDomain);
......
......@@ -23,9 +23,6 @@ goog.provide('historian.levelSummary.DimensionTypes');
goog.provide('historian.levelSummary.Dimensions');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('historian.metrics');
goog.require('historian.metrics.Csv');
goog.require('historian.time');
......@@ -215,6 +212,7 @@ historian.LevelSummaryData.prototype.parseCsv_ = function(csv) {
this.properties = properties;
};
/**
* Find the items intersecting the given time range.
* @param {number} startTime The left side of the time range.
......
......@@ -293,8 +293,8 @@ func (s *ServiceUID) assign(curTime int64, summaryActive bool, summaryStartTime
return fmt.Errorf("unknown transition for %q:%q", desc, tr)
}
// We need to keep the raw UID so that services can be sufficiently distinguished in the csv mapping,
// but Powerbug only deals with app IDs (with the user ID removed) so we have to make sure the csv
// prints only the app ID.
// but Battery Historian only deals with app IDs (with the user ID removed)
// so we have to make sure the csv prints only the app ID.
csv.AddEntryWithOpt(desc, s, curTime, fmt.Sprint(appID))
return nil
}
......
......@@ -36,6 +36,7 @@ const (
closureCompilerURL = "http://dl.google.com/closure-compiler/" + closureCompilerZip
thirdPartyDir = "third_party"
compiledDir = "compiled"
)
var rebuild = flag.Bool("rebuild", false, "Whether or not clear all setup files and start from scratch.")
......@@ -86,20 +87,25 @@ func main() {
if *rebuild {
fmt.Println("\nClearing files...")
if err := deletePath(thirdPartyDir); err != nil {
fmt.Printf("Failed to delete third_party directory: %v\n", err)
fmt.Printf("Failed to delete %s directory: %v\n", thirdPartyDir, err)
return
}
if err := deletePath("compiled"); err != nil {
fmt.Printf("Failed to delete compiled directory: %v\n", err)
if err := deletePath(compiledDir); err != nil {
fmt.Printf("Failed to delete %s directory: %v\n", compiledDir, err)
return
}
}
os.Mkdir(thirdPartyDir, 0777)
os.Mkdir("compiled", 0777)
os.Mkdir(compiledDir, 0777)
closureLibraryDir := path.Join(thirdPartyDir, "closure-library")
closureCompilerDir := path.Join(thirdPartyDir, "closure-compiler")
wd, err := os.Getwd()
if err != nil {
fmt.Printf("Unable to get working directory: %v\n", err)
return
}
closureLibraryDir := path.Join(wd, thirdPartyDir, "closure-library")
closureCompilerDir := path.Join(wd, thirdPartyDir, "closure-compiler")
axisDir := path.Join(thirdPartyDir, "flot-axislabels")
if _, err := os.Stat(closureLibraryDir); os.IsNotExist(err) {
......@@ -119,6 +125,11 @@ func main() {
os.Mkdir(closureCompilerDir, 0777)
resp, err := http.Get(closureCompilerURL)
if err != nil {
fmt.Printf("Failed to download Closure compiler: %v\n", err)
fmt.Printf("\nIf this persists, please manually download the compiler from %s into the %s directory, unzip it into the %s diretory, and rerun this script.\n\n", closureCompilerURL, closureCompilerDir, closureCompilerDir)
return
}
defer resp.Body.Close()
contents, err := ioutil.ReadAll(resp.Body)
......@@ -160,7 +171,7 @@ func main() {
fmt.Printf("Couldn't generate runfile: %v\n", err)
return
}
if err = saveFile("compiled/historian_deps-runfiles.js", []byte(out)); err != nil {
if err = saveFile(path.Join(wd, compiledDir, "historian_deps-runfiles.js"), []byte(out)); err != nil {
fmt.Printf("Couldn't save runfiles file: %v\n", err)
return
}
......@@ -174,8 +185,8 @@ func main() {
"--js", path.Join(closureLibraryDir, "closure/goog/**/*.js"),
"--only_closure_dependencies",
"--generate_exports",
"--js_output_file", "compiled/historian-optimized.js",
"--output_manifest", "compiled/manifest.MF",
"--js_output_file", path.Join(wd, compiledDir, "historian-optimized.js"),
"--output_manifest", path.Join(wd, compiledDir, "manifest.MF"),
"--compilation_level", "SIMPLE_OPTIMIZATIONS",
)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册