diff --git a/README.md b/README.md index 5c5a7e61215283b241232745192738ede33743a6..086cd91c83e178e4f2bf7d4b6420ec59440550f4 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,8 @@ $ adb bugreport > bugreport.txt ### Start analyzing! -You are all set now. Run `historian` and visit and upload the `bugreport.txt` file to start analyzing. +You are all set now. Run `historian` and visit 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 diff --git a/historianutils/historianutils.go b/historianutils/historianutils.go index 41c03e01b9b999741ea54ea89bb7f294ff13d516..35c4e23e3bacf64f3e1ffb218d0e115a9d7c38aa 100644 --- a/historianutils/historianutils.go +++ b/historianutils/historianutils.go @@ -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 diff --git a/js/level_configs_test.js b/js/level_configs_test.js index a622872fc3a45932bcec8d149fc0b7c2acec8e39..57b49fb647d87d336a5ba775639ed942de9884c2 100644 --- a/js/level_configs_test.js +++ b/js/level_configs_test.js @@ -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); diff --git a/js/level_summary.js b/js/level_summary.js index 7416d9c8092ea039a723dc016b200eb6dfeaaaf1..175223cd6210326a85816a6a92f8ca5ea42d7773 100644 --- a/js/level_summary.js +++ b/js/level_summary.js @@ -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. diff --git a/parseutils/parseutils.go b/parseutils/parseutils.go index feac73ad82d8deeb6465706c88d2c4441091d580..c3775065b0179f1f2b2724c01a3ece0731c183e3 100644 --- a/parseutils/parseutils.go +++ b/parseutils/parseutils.go @@ -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 } diff --git a/setup.go b/setup.go index ecd701f77b7b05050307599a034c168f09a475de..92a10781b0ace5ecf4e658cca1004d4be00b2d19 100644 --- a/setup.go +++ b/setup.go @@ -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", ) }