Rapl node capping daemon #21

Merged
ridv merged 18 commits from raplDaemon into master 2020-01-19 19:52:32 +00:00
Showing only changes of commit 74545680fc - Show all commits

View file

@ -10,7 +10,7 @@ import (
pradykaushik commented 2020-01-13 19:11:14 +00:00 (Migrated from github.com)

missing period at the end of the sentence.

missing period at the end of the sentence.
pradykaushik commented 2020-01-13 19:13:15 +00:00 (Migrated from github.com)

missing period at end of sentence.

missing period at end of sentence.
pradykaushik commented 2020-01-13 19:11:14 +00:00 (Migrated from github.com)

missing period at the end of the sentence.

missing period at the end of the sentence.
pradykaushik commented 2020-01-13 19:13:15 +00:00 (Migrated from github.com)

missing period at end of sentence.

missing period at end of sentence.
const powercapDir = "/sys/class/powercap/"
// Cap is a payload that is expected from Elektron to cap a node
pradykaushik commented 2020-01-13 19:11:14 +00:00 (Migrated from github.com)

missing period at the end of the sentence.

missing period at the end of the sentence.
pradykaushik commented 2020-01-13 19:13:15 +00:00 (Migrated from github.com)

missing period at end of sentence.

missing period at end of sentence.
// Cap is a payload that is expected from Elektron to cap a node.
pradykaushik commented 2020-01-13 19:11:14 +00:00 (Migrated from github.com)

missing period at the end of the sentence.

missing period at the end of the sentence.
pradykaushik commented 2020-01-13 19:13:15 +00:00 (Migrated from github.com)

missing period at end of sentence.

missing period at end of sentence.
type Cap struct {
Percentage int
}
@ -24,13 +24,13 @@ func main() {
pradykaushik commented 2020-01-13 19:11:14 +00:00 (Migrated from github.com)

missing period at the end of the sentence.

missing period at the end of the sentence.
pradykaushik commented 2020-01-13 19:13:15 +00:00 (Migrated from github.com)

missing period at end of sentence.

missing period at end of sentence.
pradykaushik commented 2020-01-13 19:11:14 +00:00 (Migrated from github.com)

missing period at the end of the sentence.

missing period at the end of the sentence.
pradykaushik commented 2020-01-13 19:13:15 +00:00 (Migrated from github.com)

missing period at end of sentence.

missing period at end of sentence.
log.Fatal(http.ListenAndServe(":9090", nil))
}
// Handler powercapping HTTP API endpoint
pradykaushik commented 2020-01-13 19:11:14 +00:00 (Migrated from github.com)

missing period at the end of the sentence.

missing period at the end of the sentence.
pradykaushik commented 2020-01-13 19:13:15 +00:00 (Migrated from github.com)

missing period at end of sentence.

missing period at end of sentence.
// Handler for the powercapping HTTP API endpoint.
pradykaushik commented 2020-01-13 19:11:14 +00:00 (Migrated from github.com)

missing period at the end of the sentence.

missing period at the end of the sentence.
pradykaushik commented 2020-01-13 19:13:15 +00:00 (Migrated from github.com)

missing period at end of sentence.

missing period at end of sentence.
pradykaushik commented 2020-01-13 19:12:52 +00:00 (Migrated from github.com)

error messages should be lowercase.

error messages should be lowercase.
ridv commented 2020-01-17 17:25:49 +00:00 (Migrated from github.com)

In this case this is some http content being served back to to the client that made the request. I did make it lower case though.

In this case this is some http content being served back to to the client that made the request. I did make it lower case though.
func powercapEndpoint(w http.ResponseWriter, r *http.Request) {
var payload Cap
decoder := json.NewDecoder(r.Body)
err := decoder.Decode(&payload)
if err != nil {
http.Error(w, "Error parsing payload: "+err.Error(), 400)
pradykaushik commented 2020-01-13 19:11:14 +00:00 (Migrated from github.com)

missing period at the end of the sentence.

missing period at the end of the sentence.
pradykaushik commented 2020-01-13 19:13:15 +00:00 (Migrated from github.com)

missing period at end of sentence.

missing period at end of sentence.
http.Error(w, "error parsing payload: "+err.Error(), 400)
pradykaushik commented 2020-01-13 19:11:14 +00:00 (Migrated from github.com)

missing period at the end of the sentence.

missing period at the end of the sentence.
pradykaushik commented 2020-01-13 19:13:15 +00:00 (Migrated from github.com)

missing period at end of sentence.

missing period at end of sentence.
return
}
@ -40,5 +40,5 @@ func powercapEndpoint(w http.ResponseWriter, r *http.Request) {
pradykaushik commented 2020-01-13 19:11:14 +00:00 (Migrated from github.com)

missing period at the end of the sentence.

missing period at the end of the sentence.
pradykaushik commented 2020-01-13 19:13:15 +00:00 (Migrated from github.com)

missing period at end of sentence.

missing period at end of sentence.
pradykaushik commented 2020-01-13 19:11:14 +00:00 (Migrated from github.com)

missing period at the end of the sentence.

missing period at the end of the sentence.
pradykaushik commented 2020-01-13 19:13:15 +00:00 (Migrated from github.com)

missing period at end of sentence.

missing period at end of sentence.
return
}
fmt.Fprintf(w, "Capped node at %d percent", payload.Percentage)
pradykaushik commented 2020-01-13 19:11:14 +00:00 (Migrated from github.com)

missing period at the end of the sentence.

missing period at the end of the sentence.
pradykaushik commented 2020-01-13 19:13:15 +00:00 (Migrated from github.com)

missing period at end of sentence.

missing period at end of sentence.
fmt.Fprintf(w, "capped node at %d percent", payload.Percentage)
pradykaushik commented 2020-01-13 19:11:14 +00:00 (Migrated from github.com)

missing period at the end of the sentence.

missing period at the end of the sentence.
pradykaushik commented 2020-01-13 19:13:15 +00:00 (Migrated from github.com)

missing period at end of sentence.

missing period at end of sentence.
}

pradykaushik commented 2020-01-13 19:11:14 +00:00 (Migrated from github.com)

missing period at the end of the sentence.

missing period at the end of the sentence.
pradykaushik commented 2020-01-13 19:13:15 +00:00 (Migrated from github.com)

missing period at end of sentence.

missing period at end of sentence.
pradykaushik commented 2020-01-13 19:11:14 +00:00 (Migrated from github.com)

missing period at the end of the sentence.

missing period at the end of the sentence.
pradykaushik commented 2020-01-13 19:13:15 +00:00 (Migrated from github.com)

missing period at end of sentence.

missing period at end of sentence.