@@ -406,7 +406,7 @@ func setCoreCount(cores int, myTarget target.Target, localTempDir string) (strin
406
406
fmt .Printf ("set core count per processor to %d on %s\n " , cores , myTarget .GetName ())
407
407
setScript := script.ScriptDefinition {
408
408
Name : "set core count" ,
409
- Script : fmt .Sprintf (`
409
+ ScriptTemplate : fmt .Sprintf (`
410
410
desired_core_count_per_socket=%d
411
411
num_cpus=$(ls /sys/devices/system/cpu/ | grep -E "^cpu[0-9]+$" | wc -l)
412
412
num_threads=$(lscpu | grep 'Thread(s) per core' | awk '{print $NF}')
@@ -544,14 +544,14 @@ func setLlcSize(llcSize float64, myTarget target.Target, localTempDir string) {
544
544
}
545
545
// set the LLC size
546
546
setScript := script.ScriptDefinition {
547
- Name : "set LLC size" ,
548
- Script : fmt .Sprintf ("wrmsr -a 0xC90 %d" , cacheWays [waysToSet ]),
549
- Superuser : true ,
550
- Architectures : []string {"x86_64" },
551
- Families : []string {"6" }, // Intel only
552
- Models : []string {"63" , "79" , "86" , "85" , "106" , "108" , "143" , "207" }, // not SRF, GNR
553
- Depends : []string {"wrmsr" },
554
- Lkms : []string {"msr" },
547
+ Name : "set LLC size" ,
548
+ ScriptTemplate : fmt .Sprintf ("wrmsr -a 0xC90 %d" , cacheWays [waysToSet ]),
549
+ Superuser : true ,
550
+ Architectures : []string {"x86_64" },
551
+ Families : []string {"6" }, // Intel only
552
+ Models : []string {"63" , "79" , "86" , "85" , "106" , "108" , "143" , "207" }, // not SRF, GNR
553
+ Depends : []string {"wrmsr" },
554
+ Lkms : []string {"msr" },
555
555
}
556
556
_ , err = runScript (myTarget , setScript , localTempDir )
557
557
if err != nil {
@@ -567,12 +567,12 @@ func setCoreFrequency(coreFrequency float64, myTarget target.Target, localTempDi
567
567
msr = msr | freqInt << uint (i * 8 )
568
568
}
569
569
setScript := script.ScriptDefinition {
570
- Name : "set frequency bins" ,
571
- Script : fmt .Sprintf ("wrmsr -a 0x1AD %d" , msr ),
572
- Superuser : true ,
573
- Architectures : []string {"x86_64" },
574
- Families : []string {"6" }, // Intel only
575
- Depends : []string {"wrmsr" },
570
+ Name : "set frequency bins" ,
571
+ ScriptTemplate : fmt .Sprintf ("wrmsr -a 0x1AD %d" , msr ),
572
+ Superuser : true ,
573
+ Architectures : []string {"x86_64" },
574
+ Families : []string {"6" }, // Intel only
575
+ Depends : []string {"wrmsr" },
576
576
}
577
577
_ , err := runScript (myTarget , setScript , localTempDir )
578
578
if err != nil {
@@ -649,12 +649,12 @@ func setUncoreDieFrequency(maxFreq bool, computeDie bool, uncoreFrequency float6
649
649
// run script for each die of specified type
650
650
for _ , die := range dies {
651
651
setScript := script.ScriptDefinition {
652
- Name : "write max and min uncore frequency TPMI" ,
653
- Script : fmt .Sprintf ("pcm-tpmi 2 0x18 -d -b %s -w %d -i %s -e %s" , bits , value , die .instance , die .entry ),
654
- Architectures : []string {"x86_64" },
655
- Families : []string {"6" }, // Intel only
656
- Depends : []string {"pcm-tpmi" },
657
- Superuser : true ,
652
+ Name : "write max and min uncore frequency TPMI" ,
653
+ ScriptTemplate : fmt .Sprintf ("pcm-tpmi 2 0x18 -d -b %s -w %d -i %s -e %s" , bits , value , die .instance , die .entry ),
654
+ Architectures : []string {"x86_64" },
655
+ Families : []string {"6" }, // Intel only
656
+ Depends : []string {"pcm-tpmi" },
657
+ Superuser : true ,
658
658
}
659
659
_ , err = runScript (myTarget , setScript , localTempDir )
660
660
if err != nil {
@@ -674,13 +674,13 @@ func setUncoreFrequency(maxFreq bool, uncoreFrequency float64, myTarget target.T
674
674
fmt .Printf ("set uncore %s frequency to %.1f GHz on %s\n " , minmax , uncoreFrequency , myTarget .GetName ())
675
675
scripts := []script.ScriptDefinition {}
676
676
scripts = append (scripts , script.ScriptDefinition {
677
- Name : "get uncore frequency MSR" ,
678
- Script : "rdmsr 0x620" ,
679
- Lkms : []string {"msr" },
680
- Architectures : []string {"x86_64" },
681
- Families : []string {"6" }, // Intel only
682
- Depends : []string {"rdmsr" },
683
- Superuser : true ,
677
+ Name : "get uncore frequency MSR" ,
678
+ ScriptTemplate : "rdmsr 0x620" ,
679
+ Lkms : []string {"msr" },
680
+ Architectures : []string {"x86_64" },
681
+ Families : []string {"6" }, // Intel only
682
+ Depends : []string {"rdmsr" },
683
+ Superuser : true ,
684
684
})
685
685
outputs , err := script .RunScripts (myTarget , scripts , true , localTempDir )
686
686
if err != nil {
@@ -727,13 +727,13 @@ func setUncoreFrequency(maxFreq bool, uncoreFrequency float64, myTarget target.T
727
727
newVal = newVal | newFreq << 8
728
728
}
729
729
setScript := script.ScriptDefinition {
730
- Name : "set uncore frequency MSR" ,
731
- Script : fmt .Sprintf ("wrmsr -a 0x620 %d" , newVal ),
732
- Superuser : true ,
733
- Architectures : []string {"x86_64" },
734
- Families : []string {"6" }, // Intel only
735
- Lkms : []string {"msr" },
736
- Depends : []string {"wrmsr" },
730
+ Name : "set uncore frequency MSR" ,
731
+ ScriptTemplate : fmt .Sprintf ("wrmsr -a 0x620 %d" , newVal ),
732
+ Superuser : true ,
733
+ Architectures : []string {"x86_64" },
734
+ Families : []string {"6" }, // Intel only
735
+ Lkms : []string {"msr" },
736
+ Depends : []string {"wrmsr" },
737
737
}
738
738
_ , err = runScript (myTarget , setScript , localTempDir )
739
739
if err != nil {
@@ -744,13 +744,13 @@ func setUncoreFrequency(maxFreq bool, uncoreFrequency float64, myTarget target.T
744
744
func setPower (power int , myTarget target.Target , localTempDir string ) {
745
745
fmt .Printf ("set power to %d Watts on %s\n " , power , myTarget .GetName ())
746
746
readScript := script.ScriptDefinition {
747
- Name : "get power MSR" ,
748
- Script : "rdmsr 0x610" ,
749
- Superuser : true ,
750
- Architectures : []string {"x86_64" },
751
- Families : []string {"6" }, // Intel only
752
- Lkms : []string {"msr" },
753
- Depends : []string {"rdmsr" },
747
+ Name : "get power MSR" ,
748
+ ScriptTemplate : "rdmsr 0x610" ,
749
+ Superuser : true ,
750
+ Architectures : []string {"x86_64" },
751
+ Families : []string {"6" }, // Intel only
752
+ Lkms : []string {"msr" },
753
+ Depends : []string {"rdmsr" },
754
754
}
755
755
readOutput , err := script .RunScript (myTarget , readScript , localTempDir )
756
756
if err != nil {
@@ -768,13 +768,13 @@ func setPower(power int, myTarget target.Target, localTempDir string) {
768
768
// add in the new power value
769
769
newVal = newVal | uint64 (power * 8 )
770
770
setScript := script.ScriptDefinition {
771
- Name : "set tdp" ,
772
- Script : fmt .Sprintf ("wrmsr -a 0x610 %d" , newVal ),
773
- Superuser : true ,
774
- Architectures : []string {"x86_64" },
775
- Families : []string {"6" }, // Intel only
776
- Lkms : []string {"msr" },
777
- Depends : []string {"wrmsr" },
771
+ Name : "set tdp" ,
772
+ ScriptTemplate : fmt .Sprintf ("wrmsr -a 0x610 %d" , newVal ),
773
+ Superuser : true ,
774
+ Architectures : []string {"x86_64" },
775
+ Families : []string {"6" }, // Intel only
776
+ Lkms : []string {"msr" },
777
+ Depends : []string {"wrmsr" },
778
778
}
779
779
_ , err := runScript (myTarget , setScript , localTempDir )
780
780
if err != nil {
@@ -787,13 +787,13 @@ func setPower(power int, myTarget target.Target, localTempDir string) {
787
787
func setEpb (epb int , myTarget target.Target , localTempDir string ) {
788
788
fmt .Printf ("set energy performance bias (EPB) to %d on %s\n " , epb , myTarget .GetName ())
789
789
setScript := script.ScriptDefinition {
790
- Name : "set epb" ,
791
- Script : fmt .Sprintf ("wrmsr -a 0x1B0 %d" , epb ),
792
- Superuser : true ,
793
- Architectures : []string {"x86_64" },
794
- Families : []string {"6" }, // Intel only
795
- Lkms : []string {"msr" },
796
- Depends : []string {"wrmsr" },
790
+ Name : "set epb" ,
791
+ ScriptTemplate : fmt .Sprintf ("wrmsr -a 0x1B0 %d" , epb ),
792
+ Superuser : true ,
793
+ Architectures : []string {"x86_64" },
794
+ Families : []string {"6" }, // Intel only
795
+ Lkms : []string {"msr" },
796
+ Depends : []string {"wrmsr" },
797
797
}
798
798
_ , err := runScript (myTarget , setScript , localTempDir )
799
799
if err != nil {
@@ -808,13 +808,13 @@ func setEpp(epp int, myTarget target.Target, localTempDir string) {
808
808
809
809
// get the current value of the IAEW_HWP_REQUEST MSR that includes the current EPP valid value in bit 60
810
810
getScript := script.ScriptDefinition {
811
- Name : "get epp msr" ,
812
- Script : "rdmsr 0x774" , // IA32_HWP_REQUEST
813
- Architectures : []string {"x86_64" },
814
- Families : []string {"6" }, // Intel only
815
- Lkms : []string {"msr" },
816
- Depends : []string {"rdmsr" },
817
- Superuser : true ,
811
+ Name : "get epp msr" ,
812
+ ScriptTemplate : "rdmsr 0x774" , // IA32_HWP_REQUEST
813
+ Architectures : []string {"x86_64" },
814
+ Families : []string {"6" }, // Intel only
815
+ Lkms : []string {"msr" },
816
+ Depends : []string {"rdmsr" },
817
+ Superuser : true ,
818
818
}
819
819
stdout , err := runScript (myTarget , getScript , localTempDir )
820
820
if err != nil {
@@ -832,13 +832,13 @@ func setEpp(epp int, myTarget target.Target, localTempDir string) {
832
832
eppValue := maskedValue | uint64 (epp )<< 24
833
833
// write it back to the MSR
834
834
setScript := script.ScriptDefinition {
835
- Name : "set epp" ,
836
- Script : fmt .Sprintf ("wrmsr -a 0x774 %d" , eppValue ),
837
- Superuser : true ,
838
- Architectures : []string {"x86_64" },
839
- Families : []string {"6" }, // Intel only
840
- Lkms : []string {"msr" },
841
- Depends : []string {"wrmsr" },
835
+ Name : "set epp" ,
836
+ ScriptTemplate : fmt .Sprintf ("wrmsr -a 0x774 %d" , eppValue ),
837
+ Superuser : true ,
838
+ Architectures : []string {"x86_64" },
839
+ Families : []string {"6" }, // Intel only
840
+ Lkms : []string {"msr" },
841
+ Depends : []string {"wrmsr" },
842
842
}
843
843
_ , err = runScript (myTarget , setScript , localTempDir )
844
844
if err != nil {
@@ -848,13 +848,13 @@ func setEpp(epp int, myTarget target.Target, localTempDir string) {
848
848
849
849
// get the current value of the IA32_HWP_REQUEST_PKG MSR that includes the current package EPP value
850
850
getScript = script.ScriptDefinition {
851
- Name : "get epp pkg msr" ,
852
- Script : "rdmsr 0x772" , // IA32_HWP_REQUEST_PKG
853
- Architectures : []string {"x86_64" },
854
- Families : []string {"6" }, // Intel only
855
- Lkms : []string {"msr" },
856
- Depends : []string {"rdmsr" },
857
- Superuser : true ,
851
+ Name : "get epp pkg msr" ,
852
+ ScriptTemplate : "rdmsr 0x772" , // IA32_HWP_REQUEST_PKG
853
+ Architectures : []string {"x86_64" },
854
+ Families : []string {"6" }, // Intel only
855
+ Lkms : []string {"msr" },
856
+ Depends : []string {"rdmsr" },
857
+ Superuser : true ,
858
858
}
859
859
stdout , err = runScript (myTarget , getScript , localTempDir )
860
860
if err != nil {
@@ -873,13 +873,13 @@ func setEpp(epp int, myTarget target.Target, localTempDir string) {
873
873
eppValue = maskedValue | uint64 (epp )<< 24
874
874
// write it back to the MSR
875
875
setScript = script.ScriptDefinition {
876
- Name : "set epp" ,
877
- Script : fmt .Sprintf ("wrmsr -a 0x772 %d" , eppValue ),
878
- Superuser : true ,
879
- Architectures : []string {"x86_64" },
880
- Families : []string {"6" }, // Intel only
881
- Lkms : []string {"msr" },
882
- Depends : []string {"wrmsr" },
876
+ Name : "set epp" ,
877
+ ScriptTemplate : fmt .Sprintf ("wrmsr -a 0x772 %d" , eppValue ),
878
+ Superuser : true ,
879
+ Architectures : []string {"x86_64" },
880
+ Families : []string {"6" }, // Intel only
881
+ Lkms : []string {"msr" },
882
+ Depends : []string {"wrmsr" },
883
883
}
884
884
_ , err = runScript (myTarget , setScript , localTempDir )
885
885
if err != nil {
@@ -890,9 +890,9 @@ func setEpp(epp int, myTarget target.Target, localTempDir string) {
890
890
func setGovernor (governor string , myTarget target.Target , localTempDir string ) {
891
891
fmt .Printf ("set governor to %s on %s\n " , governor , myTarget .GetName ())
892
892
setScript := script.ScriptDefinition {
893
- Name : "set governor" ,
894
- Script : fmt .Sprintf ("echo %s | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor" , governor ),
895
- Superuser : true ,
893
+ Name : "set governor" ,
894
+ ScriptTemplate : fmt .Sprintf ("echo %s | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor" , governor ),
895
+ Superuser : true ,
896
896
}
897
897
_ , err := runScript (myTarget , setScript , localTempDir )
898
898
if err != nil {
@@ -913,13 +913,13 @@ func setElc(elc string, myTarget target.Target, localTempDir string) {
913
913
return
914
914
}
915
915
setScript := script.ScriptDefinition {
916
- Name : "set elc" ,
917
- Script : fmt .Sprintf ("bhs-power-mode.sh --%s" , mode ),
918
- Superuser : true ,
919
- Architectures : []string {"x86_64" },
920
- Families : []string {"6" }, // Intel only
921
- Models : []string {"173" , "175" }, // GNR and SRF only
922
- Depends : []string {"bhs-power-mode.sh" },
916
+ Name : "set elc" ,
917
+ ScriptTemplate : fmt .Sprintf ("bhs-power-mode.sh --%s" , mode ),
918
+ Superuser : true ,
919
+ Architectures : []string {"x86_64" },
920
+ Families : []string {"6" }, // Intel only
921
+ Models : []string {"173" , "175" }, // GNR and SRF only
922
+ Depends : []string {"bhs-power-mode.sh" },
923
923
}
924
924
_ , err := runScript (myTarget , setScript , localTempDir )
925
925
if err != nil {
0 commit comments