-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# This is a combination of 252 commits.
parent 6674807 author HermioneKT <[email protected]> 1706694164 +0800 committer HermioneKT <[email protected]> 1706694164 +0800 test # This is the commit message #157: test # This is the commit message #159: test # This is the commit message #160: test # This is the commit message #161: test # This is the commit message #162: test # This is the commit message #163: test # This is the commit message #164: tesT # This is the commit message #165: test # This is the commit message #166: test # This is the commit message #167: test # This is the commit message #168: test # This is the commit message #169: test # This is the commit message #170: test # This is the commit message #171: Test # This is the commit message #172: test # This is the commit message #173: test # This is the commit message #174: test # This is the commit message #175: test # This is the commit message #176: test # This is the commit message #177: test # This is the commit message #178: test # This is the commit message #179: test # This is the commit message #180: test # This is the commit message #181: test # This is the commit message #182: test # This is the commit message #183: test # This is the commit message #184: test # This is the commit message #185: test # This is the commit message #186: test # This is the commit message #187: test # This is the commit message #188: test # This is the commit message #189: test # This is the commit message #190: Test # This is the commit message #191: Test # This is the commit message #192: test # This is the commit message #193: Test # This is the commit message #194: test # This is the commit message #195: test # This is the commit message #196: test # This is the commit message #197: test # This is the commit message #198: test # This is the commit message #199: Test # This is the commit message #200: test # This is the commit message #201: test # This is the commit message #202: Test # This is the commit message #203: test # This is the commit message #204: test # This is the commit message #205: test # This is the commit message #206: test # This is the commit message #207: test # This is the commit message #208: test # This is the commit message #209: test # This is the commit message #210: test # This is the commit message #211: Test # This is the commit message #212: test # This is the commit message #213: Test # This is the commit message #214: Test # This is the commit message #215: Test # This is the commit message #216: test # This is the commit message #217: Test # This is the commit message #218: test # This is the commit message #219: test # This is the commit message #220: test # This is the commit message #221: test # This is the commit message #222: test # This is the commit message #223: test # This is the commit message #224: test # This is the commit message #225: test # This is the commit message #226: test # This is the commit message #227: test # This is the commit message #228: test # This is the commit message #229: Test # This is the commit message #230: test # This is the commit message #231: test # This is the commit message #232: test # This is the commit message #233: test # This is the commit message #234: Test # This is the commit message #235: test # This is the commit message #236: test # This is the commit message #237: test # This is the commit message #238: test # This is the commit message #239: test # This is the commit message #240: test # This is the commit message #241: test # This is the commit message #242: test # This is the commit message #243: test # This is the commit message #244: test # This is the commit message #245: test # This is the commit message #246: test # This is the commit message #247: test # This is the commit message #248: test # This is the commit message #249: test # This is the commit message #250: test # This is the commit message #251: test # This is the commit message #252: test
- Loading branch information
1 parent
c8e724c
commit 3c6919f
Showing
22 changed files
with
453,723 additions
and
8,032 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/csv" | ||
"fmt" | ||
"os" | ||
"os/exec" | ||
"strconv" | ||
"sync" | ||
"time" | ||
|
||
) | ||
|
||
func setPowerProfileToNodes(freq1 int64, freq2 int64) error { | ||
fmt.Printf("node1:%d, node2:%d\n", freq1, freq2) | ||
// powerConfig | ||
command := fmt.Sprintf("kubectl apply -f - <<EOF\napiVersion: \"power.intel.com/v1\"\nkind: PowerConfig\nmetadata:\n name: power-config\n namespace: intel-power\nspec:\n powerNodeSelector:\n kubernetes.io/os: linux\n powerProfiles:\n - \"performance\"\nEOF") | ||
cmd := exec.Command("bash", "-c", command) | ||
_, err := cmd.CombinedOutput() | ||
if err != nil { | ||
return err | ||
} | ||
//fmt.Println(string(output)) | ||
|
||
// performanceProfile w freq | ||
command = fmt.Sprintf("kubectl apply -f - <<EOF\napiVersion: \"power.intel.com/v1\"\nkind: PowerProfile\nmetadata:\n name: performance-node1\n namespace: intel-power\nspec:\n name: \"performance-node1\"\n max: %d\n min: %d\n shared: true\n governor: \"performance\"\nEOF", freq1, freq1) | ||
cmd = exec.Command("bash", "-c", command) | ||
_, err = cmd.CombinedOutput() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
command = fmt.Sprintf("kubectl apply -f - <<EOF\napiVersion: \"power.intel.com/v1\"\nkind: PowerProfile\nmetadata:\n name: performance-node2\n namespace: intel-power\nspec:\n name: \"performance-node2\"\n max: %d\n min: %d\n shared: true\n governor: \"performance\"\nEOF", freq2, freq2) | ||
cmd = exec.Command("bash", "-c", command) | ||
_, err = cmd.CombinedOutput() | ||
if err != nil { | ||
return err | ||
} | ||
//fmt.Println(string(output)) | ||
|
||
// apply to node | ||
command = fmt.Sprintf("kubectl apply -f - <<EOF\napiVersion: \"power.intel.com/v1\"\nkind: PowerWorkload\nmetadata:\n name: performance-node-1.kt-cluster.ntu-cloud-pg0.utah.cloudlab.us-workload\n namespace: intel-power\nspec:\n name: \"performance-node-1.kt-cluster.ntu-cloud-pg0.utah.cloudlab.us-workload\"\n allCores: true\n powerNodeSelector:\n kubernetes.io/hostname: node-1.kt-cluster.ntu-cloud-pg0.utah.cloudlab.us\n powerProfile: \"performance-node1\"\nEOF") | ||
cmd = exec.Command("bash", "-c", command) | ||
_, err = cmd.CombinedOutput() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
command = fmt.Sprintf("kubectl apply -f - <<EOF\napiVersion: \"power.intel.com/v1\"\nkind: PowerWorkload\nmetadata:\n name: performance-node-2.kt-cluster.ntu-cloud-pg0.utah.cloudlab.us-workload\n namespace: intel-power\nspec:\n name: \"performance-node-2.kt-cluster.ntu-cloud-pg0.utah.cloudlab.us-workload\"\n allCores: true\n powerNodeSelector:\n kubernetes.io/hostname: node-2.kt-cluster.ntu-cloud-pg0.utah.cloudlab.us\n powerProfile: \"performance-node2\"\nEOF") | ||
cmd = exec.Command("bash", "-c", command) | ||
_, err = cmd.CombinedOutput() | ||
if err != nil { | ||
return err | ||
} | ||
//fmt.Println(string(output)) | ||
return nil | ||
} | ||
|
||
func spinning(wg *sync.WaitGroup, resultChan chan int64) { | ||
defer wg.Done() | ||
|
||
url := "aes-python.default.192.168.1.240.sslip.io" | ||
command := fmt.Sprintf("cd $HOME/vSwarm/tools/test-client && ./test-client --addr %s:80 --name \"allow\"", url) | ||
|
||
startInvoke := time.Now().UTC().UnixMilli() | ||
cmd := exec.Command("bash", "-c", command) | ||
_, err := cmd.CombinedOutput() | ||
if err != nil { | ||
fmt.Printf(fmt.Sprintf("ERR2: %+v", err)) | ||
return | ||
} | ||
endInvoke := time.Now().UTC().UnixMilli() | ||
latency := endInvoke-startInvoke | ||
resultChan <- latency | ||
fmt.Println(latency) | ||
return | ||
} | ||
|
||
func sleeping(wg *sync.WaitGroup, resultChan chan int64) { | ||
defer wg.Done() | ||
|
||
url := "auth-python.default.192.168.1.240.sslip.io" | ||
command := fmt.Sprintf("cd $HOME/vSwarm/tools/test-client && ./test-client --addr %s:80 --name \"allow\"", url) | ||
|
||
startInvoke := time.Now().UTC().UnixMilli() | ||
cmd := exec.Command("bash", "-c", command) | ||
_, err := cmd.CombinedOutput() | ||
if err != nil { | ||
fmt.Printf(fmt.Sprintf("ERR2: %+v", err)) | ||
return | ||
} | ||
endInvoke := time.Now().UTC().UnixMilli() | ||
latency := endInvoke-startInvoke | ||
resultChan <- latency | ||
fmt.Println(latency) | ||
return | ||
} | ||
|
||
func main() { | ||
file, err := os.Create("metrics.csv") | ||
if err != nil { | ||
panic(err) | ||
} | ||
defer file.Close() | ||
|
||
writer1 := csv.NewWriter(file) | ||
defer writer1.Flush() | ||
|
||
err = writer1.Write(append([]string{"startTime", "endTime", "spinningLatency", "sleepingLatency"})) | ||
if err != nil { | ||
fmt.Printf("Error writing metrics to the CSV file: %v\n", err) | ||
} | ||
|
||
// frequencies := [][]int64{{1200,1200},{1200,2400},{2400,2400}} | ||
// for i := 0; i < len(frequencies); i++ { | ||
// err := setPowerProfileToNodes(frequencies[i][0], frequencies[i][1]) | ||
// if err != nil { | ||
// fmt.Printf(fmt.Sprintf("ERR1 :%+v", err)) | ||
// } | ||
|
||
now := time.Now() | ||
for time.Since(now) < (time.Minute*2) { | ||
// Create channels to receive results from goroutines | ||
spinningResultChan := make(chan int64) | ||
sleepingResultChan := make(chan int64) | ||
|
||
startInvoke := time.Now().UTC().UnixMilli() | ||
go func() { | ||
url := "auth-python.default.192.168.1.240.sslip.io" | ||
command := fmt.Sprintf("cd $HOME/vSwarm/tools/test-client && ./test-client --addr %s:80 --name \"allow\"", url) | ||
|
||
startInvoke := time.Now().UTC().UnixMilli() | ||
cmd := exec.Command("bash", "-c", command) | ||
_, err := cmd.CombinedOutput() | ||
if err != nil { | ||
fmt.Printf(fmt.Sprintf("ERR2: %+v", err)) | ||
return | ||
} | ||
endInvoke := time.Now().UTC().UnixMilli() | ||
latency := endInvoke-startInvoke | ||
sleepingResultChan <- latency | ||
}() | ||
|
||
go func() { | ||
url := "aes-python.default.192.168.1.240.sslip.io" | ||
command := fmt.Sprintf("cd $HOME/vSwarm/tools/test-client && ./test-client --addr %s:80 --name \"allow\"", url) | ||
|
||
startInvoke := time.Now().UTC().UnixMilli() | ||
cmd := exec.Command("bash", "-c", command) | ||
_, err := cmd.CombinedOutput() | ||
if err != nil { | ||
fmt.Printf(fmt.Sprintf("ERR2: %+v", err)) | ||
return | ||
} | ||
endInvoke := time.Now().UTC().UnixMilli() | ||
latency := endInvoke-startInvoke | ||
spinningResultChan <- latency | ||
}() | ||
|
||
endInvoke := time.Now().UTC().UnixMilli() | ||
spinningLatency := <-spinningResultChan | ||
sleepingLatency := <-sleepingResultChan | ||
err = writer1.Write(append([]string{strconv.FormatInt(startInvoke, 10), strconv.FormatInt(endInvoke, 10), strconv.FormatInt(spinningLatency, 10), strconv.FormatInt(sleepingLatency, 10)})) | ||
if err != nil { | ||
fmt.Printf("Error writing metrics to the CSV file: %v\n", err) | ||
} | ||
} | ||
|
||
err = writer1.Write(append([]string{"-","-","-","-"})) | ||
if err != nil { | ||
fmt.Printf("Error writing metrics to the CSV file: %v\n", err) | ||
} | ||
fmt.Println("done") | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,27 @@ | ||
kubectl apply -f - <<EOF | ||
apiVersion: "power.intel.com/v1" | ||
apiVersion: power.intel.com/v1 | ||
kind: PowerProfile | ||
metadata: | ||
name: performance | ||
name: shared-node1 | ||
namespace: intel-power | ||
spec: | ||
name: "performance" | ||
max: 3400 | ||
min: 3400 | ||
shared: true | ||
governor: "performance" | ||
name: "shared-node1" | ||
max: 1500 | ||
min: 1500 | ||
shared: true | ||
governor: "powersave" | ||
EOF | ||
|
||
kubectl apply -f - <<EOF | ||
apiVersion: power.intel.com/v1 | ||
kind: PowerProfile | ||
metadata: | ||
name: shared-node2 | ||
namespace: intel-power | ||
spec: | ||
name: "shared-node2" | ||
max: 2500 | ||
min: 2500 | ||
shared: true | ||
governor: "powersave" | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.