Skip to content

Commit

Permalink
add some notices for console
Browse files Browse the repository at this point in the history
  • Loading branch information
XieBiao committed Feb 26, 2018
1 parent 2700a2e commit ccaab50
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Redis memory analysis
2. Run

```Shell
# help
./redis-memory-analysis-linux-amd64 -h
Usage of ./redis-memory-analysis-darwin-amd64:
-ip string
Expand All @@ -22,6 +23,9 @@ Usage of ./redis-memory-analysis-darwin-amd64:
The prefixes list of redis key, be split by ',', special pattern characters need to escape by '\' (default "#,:")
-reportPath string
The csv file path of analysis result (default "./reports")

# run
./redis-memory-analysis-linux-amd64 -ip="127.0.0.1" -port=6380 -password="abc"
```

## Source Code Usage
Expand Down
4 changes: 3 additions & 1 deletion analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (analysis *Analysis) Close() {
}

func (analysis Analysis) Start(delimiters []string) {

fmt.Println("Starting analysis")
match := "*[" + strings.Join(delimiters, "") + "]*"
databases, _ := analysis.redis.GetDatabases()

Expand All @@ -75,6 +75,7 @@ func (analysis Analysis) Start(delimiters []string) {
)

for db, _ := range databases {
fmt.Println("Analyzing db", db)
cursor = 0
mr = KeyReports{}

Expand Down Expand Up @@ -142,6 +143,7 @@ func (analysis Analysis) Start(delimiters []string) {
}

func (analysis Analysis) SaveReports(folder string) error {
fmt.Println("Saving the results of the analysis into", folder)
if _, err := os.Stat(folder); os.IsNotExist(err) {
os.MkdirAll(folder, os.ModePerm)
}
Expand Down
2 changes: 2 additions & 0 deletions examples/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ func main() {
analysis.Start(strings.Split(*prefixes, ","))

analysis.SaveReports(*reportPath)

fmt.Println("Done")
}
2 changes: 2 additions & 0 deletions examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ func main() {
//CSV file name format: redis-analysis-{host:port}-{db}.csv
//The keys order by count desc
analysis.SaveReports("./reports")

fmt.Println("Done")
}

0 comments on commit ccaab50

Please sign in to comment.