Skip to content

Commit

Permalink
To reproduce hanging with longline
Browse files Browse the repository at this point in the history
  • Loading branch information
katarzyna-z committed Aug 30, 2016
1 parent a79c0a0 commit 9738a2b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cpu/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"strconv"
"strings"
"time"
"math/rand"

"github.com/intelsdi-x/snap/control/plugin"
"github.com/intelsdi-x/snap/control/plugin/cpolicy"
Expand Down Expand Up @@ -362,7 +363,15 @@ func getStats(path string, stats map[string]map[string]interface{}, prevMetricsS
return err
}

fmt.Fprintf(os.Stderr, "Percentage value of %v could not be calculated due to invalid data reported by /proc/stat", getNamespaceMetricPart(metricName, percentageRepresentationType))
//fmt.Fprintf(os.Stderr, "Percentage value of %v could not be calculated due to invalid data reported by /proc/stat", getNamespaceMetricPart(metricName, percentageRepresentationType))

letterBytes := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
longLine := []byte{}
for i := 0; i < 8193; i++ {
longLine = append(longLine, letterBytes[rand.Intn(len(letterBytes))])
}

fmt.Fprintf(os.Stderr, "%v" , longLine)

if percVal := float64(100 * (currVal - prevVal) / diffSum); percVal < 0 {
fmt.Fprintf(os.Stderr, "Percentage value of %v could not be calculated due to invalid data reported by /proc/stat", getNamespaceMetricPart(metricName, percentageRepresentationType))
Expand Down

0 comments on commit 9738a2b

Please sign in to comment.