code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def _InstallOSReqs(self, vm): """Installs prereqs depending on the OS.""" if 'ubuntu' in vm.OS_TYPE: vm.InstallPackages(' '.join(PREREQ_UBUNTU)) elif 'centos' in vm.OS_TYPE: vm.InstallPackages(' '.join(PREREQ_CENTOS)) else: raise errors.VirtualMachine.VirtualMachineError('OS not suppor...
Installs prereqs depending on the OS.
_InstallOSReqs
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/traces/perfspect.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/perfspect.py
Apache-2.0
def _InstallTelemetry(self, vm): """Installs PerfSpect telemetry on the VM.""" logging.info('Installing PerfSpect on VM') self._InstallOSReqs(vm) vm.InstallPackages(' '.join(PREREQ_PKGS)) vm.RemoteCommand(f'sudo rm -rf {self.telemetry_dir}') vm.RemoteCommand(f'sudo mkdir -p {self.telemetry_dir}'...
Installs PerfSpect telemetry on the VM.
_InstallTelemetry
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/traces/perfspect.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/perfspect.py
Apache-2.0
def _StartTelemetry(self, vm): """Starts PerfSpect telemetry on the VM.""" try: vm.RemoteCommand('perf list') except errors.VirtualMachine.RemoteCommandError as ex: logging.exception('Failed executing perf. Is it installed?') raise ex perf_collect_file = posixpath.join( self.te...
Starts PerfSpect telemetry on the VM.
_StartTelemetry
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/traces/perfspect.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/perfspect.py
Apache-2.0
def _StopTelemetry(self, vm): """Stops PerfSpect telemetry on the VM.""" logging.info('Stopping PerfSpect telemetry') vm.RemoteCommand('sudo pkill -9 -x perf') vm.RemoteCommand(f'tail --pid={self.pid} -f /dev/null') logging.info('Post processing PerfSpect raw metrics') perf_dir = posixpath.join(...
Stops PerfSpect telemetry on the VM.
_StopTelemetry
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/traces/perfspect.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/perfspect.py
Apache-2.0
def _GetLocalArchive(self): """Gets the local path of the PerfSpect archive.""" if FLAGS.perfspect_tarball: logging.info('perfspect_tarball specified: %s', FLAGS.perfspect_tarball) local_archive_path = FLAGS.perfspect_tarball else: url = FLAGS.perfspect_url or PERFSPECT_ARCHIVE_URL l...
Gets the local path of the PerfSpect archive.
_GetLocalArchive
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/traces/perfspect.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/perfspect.py
Apache-2.0
def Before(self, unused_sender, benchmark_spec): """Installs PerfSpect Telemetry. Args: unused_sender: Unused parameter that fits event connection interface benchmark_spec: benchmark_spec.BenchmarkSpec. The benchmark currently running. """ logging.info('Installing PerfSpect telemetr...
Installs PerfSpect Telemetry. Args: unused_sender: Unused parameter that fits event connection interface benchmark_spec: benchmark_spec.BenchmarkSpec. The benchmark currently running.
Before
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/traces/perfspect.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/perfspect.py
Apache-2.0
def After(self, unused_sender, benchmark_spec): """Stops PerfSpect telemetry, fetch results from VM(s). Args: unused_sender: Unused parameter that fits event connection interface benchmark_spec: benchmark_spec.BenchmarkSpec. The benchmark that stopped running. """ vms = benchmark_sp...
Stops PerfSpect telemetry, fetch results from VM(s). Args: unused_sender: Unused parameter that fits event connection interface benchmark_spec: benchmark_spec.BenchmarkSpec. The benchmark that stopped running.
After
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/traces/perfspect.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/perfspect.py
Apache-2.0
def Register(parsed_flags): """Registers the PerfSpect collector if FLAGS.perfspect is set.""" if not parsed_flags.perfspect: return logging.info('Registering PerfSpect telemetry collector') telemetry_collector = PerfspectCollector() events.before_phase.connect( telemetry_collector.Before, events.RU...
Registers the PerfSpect collector if FLAGS.perfspect is set.
Register
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/traces/perfspect.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/perfspect.py
Apache-2.0
def _CollectorRunCommand(self, vm, collector_file): """Starts perf record in the background and returns the pid.""" cmd = ( f'sudo perf record {FLAG_PERF_RECORD_OPTIONS.value}' f' -F {FLAG_PERF_RECORD_INTERVAL.value} &>{collector_file} & echo $!' ) return cmd
Starts perf record in the background and returns the pid.
_CollectorRunCommand
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/traces/perf_record.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/perf_record.py
Apache-2.0
def Register(parsed_flags): """Registers the perf record collector if FLAGS.perf_record is set.""" if not parsed_flags.perf_record: return output_directory = vm_util.GetTempDir() logging.debug('Registering perf record collector') if not os.path.isdir(output_directory): os.makedirs(output_directory)...
Registers the perf record collector if FLAGS.perf_record is set.
Register
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/traces/perf_record.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/perf_record.py
Apache-2.0
def Register(parsed_flags): """Registers the pressure stall collector if FLAGS.pressure_stall is set.""" if not parsed_flags.pressure_stall: return logging.debug('Registering pressure stall collector.') collector = PressureStallCollector() events.before_phase.connect(collector.Start, stages.RUN, weak=Fa...
Registers the pressure stall collector if FLAGS.pressure_stall is set.
Register
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/traces/pressure_stall.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/pressure_stall.py
Apache-2.0
def _CollectorRunCommand(self, vm, collector_file): """Starts sar in the background and returns the pid.""" # NOTE that &>/dev/null is IMPORTANT, otherwise the command will get stuck cmd = f'sar -o {collector_file} {FLAGS.sar_interval} &>/dev/null & echo $!' return cmd
Starts sar in the background and returns the pid.
_CollectorRunCommand
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/traces/sar.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/sar.py
Apache-2.0
def _CollectorRunCommand(self, vm, collector_file): """Starts ss in the background and returns the pid.""" # NOTE that &>/dev/null is IMPORTANT, otherwise the command will get stuck cmd = f'./ss.sh {collector_file} &>/dev/null & echo $!' return cmd
Starts ss in the background and returns the pid.
_CollectorRunCommand
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/traces/ss.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/ss.py
Apache-2.0
def Register(parsed_flags): """Registers the ss collector if flag 'ss' is set.""" if not parsed_flags.ss: return output_directory = vm_util.GetTempDir() logging.debug( 'Registering ss collector with interval %s, output to %s.', FLAG_SS_INTERVAL.value, output_directory, ) if not os.p...
Registers the ss collector if flag 'ss' is set.
Register
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/traces/ss.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/ss.py
Apache-2.0
def Register(parsed_flags): """Registers the tcpdump collector if FLAGS.tcpdump is set.""" if not parsed_flags.tcpdump: return collector = _CreateCollector(parsed_flags) events.before_phase.connect(collector.Start, stages.RUN, weak=False) events.after_phase.connect(collector.Stop, stages.RUN, weak=False)
Registers the tcpdump collector if FLAGS.tcpdump is set.
Register
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/traces/tcpdump.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/tcpdump.py
Apache-2.0
def Register(parsed_flags): """Registers the vmstat collector if FLAGS.vmstat is set.""" if not parsed_flags.vmstat: return logging.debug('Registering vmstat collector.') collector = VmstatCollector(interval=parsed_flags.vmstat_interval) events.before_phase.connect(collector.Start, stages.RUN, weak=Fals...
Registers the vmstat collector if FLAGS.vmstat is set.
Register
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/traces/vmstat.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/traces/vmstat.py
Apache-2.0
def Run(benchmark_spec): """Measure the disk performance in one VM. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects with the benchmark results. """ vm = benchmark_spec.vms[0] results = [] ...
Measure the disk performance in one VM. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects with the benchmark results.
Run
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_benchmarks/diskspd_benchmark.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_benchmarks/diskspd_benchmark.py
Apache-2.0
def Run(benchmark_spec): """Runs the fio benchmark test. Args: benchmark_spec: specification of the benchmark. Returns: List of samples produced by the test. """ vm = benchmark_spec.vms[0] fio_exec = fio.GetFioExec() remote_job_file_path = fio.GetRemoteJobFilePath(vm) # Ignored when --fio_gen...
Runs the fio benchmark test. Args: benchmark_spec: specification of the benchmark. Returns: List of samples produced by the test.
Run
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_benchmarks/fio_benchmark.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_benchmarks/fio_benchmark.py
Apache-2.0
def CheckPrerequisites(_): """Verifies that benchmark flags is correct.""" if hammerdb.HAMMERDB_OPTIMIZED_SERVER_CONFIGURATION.value not in [ hammerdb.NON_OPTIMIZED, hammerdb.MINIMUM_RECOVERY, ]: raise errors.Setup.InvalidFlagConfigurationError( 'Non-optimized hammerdbcli_optimized_server_...
Verifies that benchmark flags is correct.
CheckPrerequisites
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_benchmarks/hammerdbcli_benchmark.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_benchmarks/hammerdbcli_benchmark.py
Apache-2.0
def Prepare(benchmark_spec): """Prepare the benchmark by installing dependencies. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. """ relational_db = benchmark_spec.relational_db vm = relational_db.client_vm num_cpus = None if hasattr(...
Prepare the benchmark by installing dependencies. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark.
Prepare
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_benchmarks/hammerdbcli_benchmark.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_benchmarks/hammerdbcli_benchmark.py
Apache-2.0
def SetMinimumRecover(relational_db): """Change sql server settings to make TPM nubmers stable.""" # https://www.mssqltips.com/sqlservertip/4541/adjust-targetrecoverytime-to-reduce-sql-server-io-spikes/ relational_db.client_vm_query_tools.IssueSqlCommand( 'ALTER DATABASE tpcc SET TARGET_RECOVERY_TIME = 1200...
Change sql server settings to make TPM nubmers stable.
SetMinimumRecover
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_benchmarks/hammerdbcli_benchmark.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_benchmarks/hammerdbcli_benchmark.py
Apache-2.0
def Run(benchmark_spec): """Run the benchmark. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample instances. """ client_vms = benchmark_spec.vm_groups['clients'] relational_db = benchmark_spec.relationa...
Run the benchmark. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample instances.
Run
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_benchmarks/hammerdbcli_benchmark.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_benchmarks/hammerdbcli_benchmark.py
Apache-2.0
def Run(benchmark_spec): """Measure UDP bandwidth between two VMs. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects with the benchmark results. """ vms = benchmark_spec.vms results = [] de...
Measure UDP bandwidth between two VMs. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects with the benchmark results.
Run
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_benchmarks/iperf3_benchmark.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_benchmarks/iperf3_benchmark.py
Apache-2.0
def _RunTest(sending_vm, receiving_vm): """Runs the tests depending on what is enabled. Args: sending_vm: The vm that will initiate the stream. receiving_vm: The vm that will act as server. """ if vm_util.ShouldRunOnExternalIpAddress(): if FLAGS.run_udp: results.extend( ...
Runs the tests depending on what is enabled. Args: sending_vm: The vm that will initiate the stream. receiving_vm: The vm that will act as server.
_RunTest
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_benchmarks/iperf3_benchmark.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_benchmarks/iperf3_benchmark.py
Apache-2.0
def Prepare(benchmark_spec): """Install ntttcp and open any ports we need.""" vms = benchmark_spec.vms for vm in vms: vm.Install('ntttcp') if vm_util.ShouldRunOnExternalIpAddress(): vm.AllowPort(ntttcp.CONTROL_PORT) # get the number of ports needed based on the flags num_ports = max([c....
Install ntttcp and open any ports we need.
Prepare
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_benchmarks/ntttcp_benchmark.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_benchmarks/ntttcp_benchmark.py
Apache-2.0
def _RunTest( benchmark_spec, sender, receiver, dest_ip, ip_type, conf, cooldown_s ): """Run a single NTTTCP test, and publish the results.""" try: results = ntttcp.RunNtttcp( sender, receiver, dest_ip, ip_type, conf.udp, conf.threads, conf.time_s, ...
Run a single NTTTCP test, and publish the results.
_RunTest
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_benchmarks/ntttcp_benchmark.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_benchmarks/ntttcp_benchmark.py
Apache-2.0
def Run(benchmark_spec): """Measure TCP stream throughput between two VMs. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects with the benchmark results. """ vm_sets = [ (benchmark_spec.vms...
Measure TCP stream throughput between two VMs. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects with the benchmark results.
Run
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_benchmarks/ntttcp_benchmark.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_benchmarks/ntttcp_benchmark.py
Apache-2.0
def RunNuttcp(vms, exec_path): """Run nuttcps tests. Args: vms: list of vms to run the tests. exec_path: path to the nuttcp executable. Returns: list of samples """ results = [] def _RunNuttcpTest(sending_vm, receiving_vm, iteration): if vm_util.ShouldRunOnExternalIpAddress(): resu...
Run nuttcps tests. Args: vms: list of vms to run the tests. exec_path: path to the nuttcp executable. Returns: list of samples
RunNuttcp
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_benchmarks/nuttcp_benchmark.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_benchmarks/nuttcp_benchmark.py
Apache-2.0
def Run(benchmark_spec): """Measure TCP latency between two VMs. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects with the benchmark results. """ vms = benchmark_spec.vms results = [] def ...
Measure TCP latency between two VMs. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects with the benchmark results.
Run
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_benchmarks/psping_benchmark.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_benchmarks/psping_benchmark.py
Apache-2.0
def DiskspdConfigListValidator(value): """Returns whether or not the config list flag is valid.""" if not value: return True for config in value: config_vals = config.split(':') if len(config_vals) < _NUM_PARAMS_IN_CONFIG: return False try: is_random_access = config_vals[0] is_re...
Returns whether or not the config list flag is valid.
DiskspdConfigListValidator
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/diskspd.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/diskspd.py
Apache-2.0
def ParseConfigList(): """Get the list of configs for the test from the flags.""" conf_list = [] if FLAGS.diskspd_config_list is None: return [ DiskspdConf( access_pattern=FLAGS.diskspd_access_pattern, write_ratio=FLAGS.diskspd_write_read_ratio, block_size=FLAGS.di...
Get the list of configs for the test from the flags.
ParseConfigList
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/diskspd.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/diskspd.py
Apache-2.0
def Install(vm): """Installs the DiskSpd package on the VM.""" zip_path = ntpath.join(vm.temp_dir, DISKSPD_ZIP) vm.DownloadFile(DISKSPD_URL, zip_path) vm.UnzipFile(zip_path, vm.temp_dir)
Installs the DiskSpd package on the VM.
Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/diskspd.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/diskspd.py
Apache-2.0
def _RunDiskSpd( running_vm, access_pattern, diskspd_write_read_ratio, block_size, metadata ): """Run single iteration of Diskspd test.""" sending_options = _GenerateOption( access_pattern, diskspd_write_read_ratio, block_size ) process_args = [(_RunDiskSpdWithOptions, (running_vm, sending_options), {...
Run single iteration of Diskspd test.
_RunDiskSpd
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/diskspd.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/diskspd.py
Apache-2.0
def _GenerateOption(access_pattern, diskspd_write_read_ratio, block_size): """Generate running options from the given flags. Args: access_pattern: the access pattern of diskspd, 's' or 'r' diskspd_write_read_ratio: the ratio of writing compared to reading. block_size: the block size of read/ write. ...
Generate running options from the given flags. Args: access_pattern: the access pattern of diskspd, 's' or 'r' diskspd_write_read_ratio: the ratio of writing compared to reading. block_size: the block size of read/ write. Returns: list of samples from the results of the diskspd tests.
_GenerateOption
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/diskspd.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/diskspd.py
Apache-2.0
def RunDiskSpd(running_vm): """Run Diskspd and return the samples collected from the run.""" metadata = {} for k, v in running_vm.GetResourceMetadata().items(): metadata['{}'.format(k)] = v # add the flag information to the metadata # some of the flags information has been included in the xml file met...
Run Diskspd and return the samples collected from the run.
RunDiskSpd
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/diskspd.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/diskspd.py
Apache-2.0
def ParseDiskSpdResults(result_xml, metadata, main_metric): """Parses the xml output from DiskSpd and returns a list of samples. each list of sample only have one sample with read speed as value all the other information is stored in the meta data Args: result_xml: diskspd output metadata: the running...
Parses the xml output from DiskSpd and returns a list of samples. each list of sample only have one sample with read speed as value all the other information is stored in the meta data Args: result_xml: diskspd output metadata: the running info of vm main_metric: the main metric to test, for example...
ParseDiskSpdResults
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/diskspd.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/diskspd.py
Apache-2.0
def Install(vm): """Installs the git package on the VM.""" git_download_path = ntpath.join(vm.temp_dir, "git", "") vm.RemoteCommand(f"New-Item -Path {git_download_path} -ItemType Directory") git_exe = ntpath.join(git_download_path, GIT_EXE) vm.DownloadFile(GIT_EXE_URL, git_exe) vm.RemoteCommand(f"{git_exe}...
Installs the git package on the VM.
Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/git.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/git.py
Apache-2.0
def AddtoPath(vm): """Adds the git path to the path environment variable.""" git_exe_path = ntpath.join(vm.temp_dir, "git") vm.RemoteCommand(f'setx PATH "$env:path;{git_exe_path}" -m')
Adds the git path to the path environment variable.
AddtoPath
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/git.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/git.py
Apache-2.0
def Install(vm): """Installs the go package on the VM.""" go_download_path = ntpath.join(vm.temp_dir, "go", "") vm.RemoteCommand(f"New-Item -Path {go_download_path} -ItemType Directory") go_msi = ntpath.join(go_download_path, GO_MSI) vm.DownloadFile(GO_MSI_URL, go_msi) vm.RemoteCommand( f"Start-Proce...
Installs the go package on the VM.
Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/go.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/go.py
Apache-2.0
def AddtoPath(vm): """Adds the go path to the path environment variable.""" go_exe_path = ntpath.join(vm.temp_dir, "go") vm.RemoteCommand(f'setx PATH "$env:path;{go_exe_path}" -m')
Adds the go path to the path environment variable.
AddtoPath
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/go.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/go.py
Apache-2.0
def Run( vm, db_engine: str, hammerdb_script: str, timeout: int | None = TIMEOUT ) -> List[sample.Sample]: """Run the HammerDB Benchmark. Runs Hammerdb TPCC or TPCH script. TPCC gathers TPM (transactions per minute) and NOPM (new order per minute). Definitions can be found here: https://www.hammerdb.com...
Run the HammerDB Benchmark. Runs Hammerdb TPCC or TPCH script. TPCC gathers TPM (transactions per minute) and NOPM (new order per minute). Definitions can be found here: https://www.hammerdb.com/blog/uncategorized/why-both-tpm-and-nopm-performance-metrics/ TPCH gathers the latency of the 22 TPCH queries. ...
Run
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/hammerdb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/hammerdb.py
Apache-2.0
def RunIperf3TCPMultiStream( sending_vm, receiving_vm, num_streams, use_internal_ip=True ): """Run a multi-stream TCP bandwidth between two VMs. Args: sending_vm: The client VM that will send the TCP packets. receiving_vm: The server VM that will receive the UDP packets. num_streams: Number of TCP ...
Run a multi-stream TCP bandwidth between two VMs. Args: sending_vm: The client VM that will send the TCP packets. receiving_vm: The server VM that will receive the UDP packets. num_streams: Number of TCP streams. use_internal_ip: if true, the private network will be used for the test. if false,...
RunIperf3TCPMultiStream
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/iperf3.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/iperf3.py
Apache-2.0
def _RunIperf3ServerClientPair(sending_vm, sender_args, receiving_vm): """Create a server-client iperf3 pair. The server exits after the client completes its request. Args: sending_vm: The client VM that will send the UDP/TCP packets. sender_args: the client VM iperf3 args. receiving_vm: The server ...
Create a server-client iperf3 pair. The server exits after the client completes its request. Args: sending_vm: The client VM that will send the UDP/TCP packets. sender_args: the client VM iperf3 args. receiving_vm: The server VM that will receive the UDP packets. Returns: output from the client...
_RunIperf3ServerClientPair
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/iperf3.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/iperf3.py
Apache-2.0
def RunIperf3UDPStream(sending_vm, receiving_vm, use_internal_ip=True): """Runs the Iperf3 UDP stream test. Args: sending_vm: The client VM that will send the UDP packets. receiving_vm: The server VM that will receive the UDP packets. use_internal_ip: if true, the private network will be used for the t...
Runs the Iperf3 UDP stream test. Args: sending_vm: The client VM that will send the UDP packets. receiving_vm: The server VM that will receive the UDP packets. use_internal_ip: if true, the private network will be used for the test. if false, the external network will be used for the test. Retur...
RunIperf3UDPStream
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/iperf3.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/iperf3.py
Apache-2.0
def ParseTCPMultiStreamOutput( results, sending_vm, receiving_vm, num_streams, internal_ip_used ): """Turns the 'results' into a list of samples. Args: results: string output of iperf3 TCP multi stream output. sending_vm: vm where the client is run. receiving_vm: vm where the server is run. num...
Turns the 'results' into a list of samples. Args: results: string output of iperf3 TCP multi stream output. sending_vm: vm where the client is run. receiving_vm: vm where the server is run. num_streams: number of TCP streams. internal_ip_used: for the metadata, lets the user know if it was the ...
ParseTCPMultiStreamOutput
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/iperf3.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/iperf3.py
Apache-2.0
def GetUDPStreamSamples( sending_vm, receiving_vm, results, bandwidth, internal_ip_used ): """Parses Iperf3 results and outputs samples for PKB. Args: sending_vm: vm where the client is run. receiving_vm: vm where the server is run. results: string containing iperf3 output. bandwidth: the bandw...
Parses Iperf3 results and outputs samples for PKB. Args: sending_vm: vm where the client is run. receiving_vm: vm where the server is run. results: string containing iperf3 output. bandwidth: the bandwidth used in the test internal_ip_used: for the metadata, lets the user know if it was the ...
GetUDPStreamSamples
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/iperf3.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/iperf3.py
Apache-2.0
def Install(vm): """Installs the mssql-tools package on the VM for Debian systems.""" # Download Visual C++ 2017 Redistributable (needed on Azure) download_path = ntpath.join(vm.temp_dir, VC_REDIST_INSTALLER) vm.DownloadFile(VC_REDIST_DOWNLOAD_LINK, download_path) vm.RemoteCommand(f'{download_path} /q /norest...
Installs the mssql-tools package on the VM for Debian systems.
Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/mssql_tools.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/mssql_tools.py
Apache-2.0
def RunNtttcp( sending_vm, receiving_vm, receiving_ip_address, ip_type, udp, threads, time_s, packet_size, cooldown, ): """Run NTttcp and return the samples collected from the run.""" if cooldown: time.sleep(FLAGS.ntttcp_cooldown_time) # Clean up any stray ntttcp processe...
Run NTttcp and return the samples collected from the run.
RunNtttcp
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/ntttcp.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/ntttcp.py
Apache-2.0
def ParseNtttcpResults(sender_xml_results, receiver_xml_results, metadata): """Parses the xml output from NTttcp and returns a list of samples. The list of samples contains total throughput and per thread throughput metrics (if there is more than a single thread). Args: sender_xml_results: ntttcp test out...
Parses the xml output from NTttcp and returns a list of samples. The list of samples contains total throughput and per thread throughput metrics (if there is more than a single thread). Args: sender_xml_results: ntttcp test output from the sender. receiver_xml_results: ntttcp test output from the receiv...
ParseNtttcpResults
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/ntttcp.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/ntttcp.py
Apache-2.0
def Install(vm): """Installs the nuttcp package on the VM.""" zip_path = ntpath.join(vm.temp_dir, NUTTCP_ZIP) @vm_util.Retry() def DownloadWithRetry(): vm.DownloadFile(NUTTCP_URL, zip_path) try: DownloadWithRetry() except errors.VirtualMachine.RemoteCommandError as e: # The mirror to download ...
Installs the nuttcp package on the VM.
Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/nuttcp.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/nuttcp.py
Apache-2.0
def _RunNuttcp(vm, options, exec_path): """Run nuttcp, server or client depending on options. Args: vm: vm to run nuttcp on options: string of options to pass to nuttcp exec_path: string path to the nuttcp executable """ command = 'cd {exec_dir}; .\\{exec_path} {options}'.format( exec_dir=vm....
Run nuttcp, server or client depending on options. Args: vm: vm to run nuttcp on options: string of options to pass to nuttcp exec_path: string path to the nuttcp executable
_RunNuttcp
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/nuttcp.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/nuttcp.py
Apache-2.0
def _GetCpuUsage(vm): """Gather CPU usage data. Args: vm: the vm to gather cpu usage data on. Raises: NuttcpNotRunningError: raised if nuttcp is not running when the CPU usage data gathering has finished. """ command = ( 'cd {exec_path}; ' "Get-Counter -Counter...
Gather CPU usage data. Args: vm: the vm to gather cpu usage data on. Raises: NuttcpNotRunningError: raised if nuttcp is not running when the CPU usage data gathering has finished.
_GetCpuUsage
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/nuttcp.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/nuttcp.py
Apache-2.0
def RunSingleBandwidth(bandwidth, sending_vm, receiving_vm, dest_ip, exec_path): """Create a server-client nuttcp pair. The server exits after the client completes its request. Args: bandwidth: the requested transmission bandwidth sending_vm: vm sending the UDP packets. receiving_vm: vm receiving th...
Create a server-client nuttcp pair. The server exits after the client completes its request. Args: bandwidth: the requested transmission bandwidth sending_vm: vm sending the UDP packets. receiving_vm: vm receiving the UDP packets. dest_ip: the IP of the receiver. exec_path: path to the nuttcp ...
RunSingleBandwidth
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/nuttcp.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/nuttcp.py
Apache-2.0
def GatherResults(vm, out_file): """Gets the contents of out_file from vm. Args: vm: the VM to get the results from. out_file: the name of the file that contains results. Returns: The contents of 'out_file' as a string. """ cat_command = 'cd {results_dir}; cat {out_file}' results_command = cat...
Gets the contents of out_file from vm. Args: vm: the VM to get the results from. out_file: the name of the file that contains results. Returns: The contents of 'out_file' as a string.
GatherResults
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/nuttcp.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/nuttcp.py
Apache-2.0
def RunNuttcp( sending_vm, receiving_vm, exec_path, dest_ip, network_type, iteration ): """Run nuttcp tests. Args: sending_vm: vm sending the UDP packets. receiving_vm: vm receiving the UDP packets. exec_path: path to the nuttcp executable. dest_ip: the IP of the receiver. network_type: str...
Run nuttcp tests. Args: sending_vm: vm sending the UDP packets. receiving_vm: vm receiving the UDP packets. exec_path: path to the nuttcp executable. dest_ip: the IP of the receiver. network_type: string representing the type of the network. iteration: the run number of the test. Returns: ...
RunNuttcp
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/nuttcp.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/nuttcp.py
Apache-2.0
def _GetCpuResults(cpu_results): r"""Transforms the string output of the cpu results. Sample output: '\r\n InstanceName CookedValue\r\n ------------ -----------\r\n 0 22.7976893740141\r\n 1 32.6422793196096\r\n 2 18.6525988706054\r\n 3 44.55941451...
Transforms the string output of the cpu results. Sample output: '\r\n InstanceName CookedValue\r\n ------------ -----------\r\n 0 22.7976893740141\r\n 1 32.6422793196096\r\n 2 18.6525988706054\r\n 3 44.5594145169094\r\n _total 29.66299386224...
_GetCpuResults
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/nuttcp.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/nuttcp.py
Apache-2.0
def GetUDPStreamSample( command_out, sender_cpu_results, receiving_cpu_results, sending_vm, receiving_vm, request_bandwidth, network_type, iteration, ): """Get a sample from the nuttcp string results. Args: command_out: the nuttcp output. sender_cpu_results: the cpu usage of...
Get a sample from the nuttcp string results. Args: command_out: the nuttcp output. sender_cpu_results: the cpu usage of the sender VM receiving_cpu_results: the cpu usage of the sender VM sending_vm: vm sending the UDP packets. receiving_vm: vm receiving the UDP packets. request_bandwidth: th...
GetUDPStreamSample
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/nuttcp.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/nuttcp.py
Apache-2.0
def Install(vm): """Installs the psping package on the VM.""" zip_path = ntpath.join(vm.temp_dir, PSPING_ZIP) vm.DownloadFile(PSPING_URL, zip_path) vm.UnzipFile(zip_path, vm.temp_dir) vm.AllowPort(TEST_PORT) vm.SetProcessPriorityToHighByFlag('psping.exe')
Installs the psping package on the VM.
Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/psping.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/psping.py
Apache-2.0
def RunLatencyTest(sending_vm, receiving_vm, use_internal_ip=True): """Run the psping latency test. Uses a TCP request-response time to measure latency. Args: sending_vm: the vm to send the tcp request. receiving_vm: the vm acting as the server. use_internal_ip: whether or not to use the private IP ...
Run the psping latency test. Uses a TCP request-response time to measure latency. Args: sending_vm: the vm to send the tcp request. receiving_vm: the vm acting as the server. use_internal_ip: whether or not to use the private IP or the public IP. Returns: list of samples representing latency be...
RunLatencyTest
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/psping.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/psping.py
Apache-2.0
def ParsePspingResults(results, client_vm, server_vm, internal_ip_used): """Turn psping output into a list of samples. Args: results: string of the psping output client_vm: the VM performing the latency test server_vm: the VM serving the latency test internal_ip_used: whether or not the private IP ...
Turn psping output into a list of samples. Args: results: string of the psping output client_vm: the VM performing the latency test server_vm: the VM serving the latency test internal_ip_used: whether or not the private IP was used. Returns: list of samples reflecting the psping results
ParsePspingResults
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/psping.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/psping.py
Apache-2.0
def Install(vm): """Installs the python3 package on the VM.""" python_download_path = ntpath.join(vm.temp_dir, "python", "") vm.RemoteCommand(f"New-Item -Path {python_download_path} -ItemType Directory") python_exe = ntpath.join(python_download_path, PYTHON_EXE) vm.DownloadFile(PYTHON_EXE_URL, python_exe) ...
Installs the python3 package on the VM.
Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/python.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/python.py
Apache-2.0
def AddtoPath(vm): """Adds the python and scripts paths to the path environment variable.""" python_exe_path = ntpath.join(vm.temp_dir, "python") # Include scripts path to enable usage of pip scripts_path = ntpath.join(python_exe_path, "scripts") vm.RemoteCommand(f'setx PATH "%PATH%;{python_exe_path};{scripts...
Adds the python and scripts paths to the path environment variable.
AddtoPath
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/python.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/python.py
Apache-2.0
def _LoadPackages(): """Imports all package modules and returns a dictionary of packages. This imports all package modules in this directory and then creates a mapping from module names to the modules themselves and returns it. """ return { module.__name__.split('.')[-1]: module for module in imp...
Imports all package modules and returns a dictionary of packages. This imports all package modules in this directory and then creates a mapping from module names to the modules themselves and returns it.
_LoadPackages
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/windows_packages/__init__.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/windows_packages/__init__.py
Apache-2.0
def testInstanceStockedOutAfterCreate(self): """This tests when run-instances succeeds and returns a pending instance. The instance then is not fulfilled and transitions to terminated. """ response = OpenJSONData('aws-describe-instance-stockout.json') util.IssueRetryableCommand.side_effect = [(resp...
This tests when run-instances succeeds and returns a pending instance. The instance then is not fulfilled and transitions to terminated.
testInstanceStockedOutAfterCreate
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/aws_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/aws_test.py
Apache-2.0
def testInternalServerErrorAfterCreate(self): """This tests when run-instances succeeds and returns a pending instance. The instance then is not fulfilled and transitions to shutting-down due to an internal server error. """ response = json.loads(self.response) state = response['Reservations'][...
This tests when run-instances succeeds and returns a pending instance. The instance then is not fulfilled and transitions to shutting-down due to an internal server error.
testInternalServerErrorAfterCreate
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/aws_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/aws_test.py
Apache-2.0
def CreateVm(): """Returns the AWS run-instances command line.""" vm_util.IssueCommand.side_effect = [('', '', 0)] util.IssueRetryableCommand.side_effect = [('', '', 0)] vm = CreateTestAwsVm() vm.network.regional_network = mock.Mock() vm.network.subnet = mock.Mock(id='subnet-1234') vm.network.placement_gr...
Returns the AWS run-instances command line.
CreateVm
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/aws_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/aws_test.py
Apache-2.0
def testBackgroundWorkloadVanillaConfig(self): """Test that nothing happens with the vanilla config.""" spec = self._CreateBenchmarkSpec(ping_benchmark.BENCHMARK_CONFIG) spec.ConstructVirtualMachines() for vm in spec.vms: self.assertIsNone(vm.background_cpu_threads) self.assertIsNone(vm.back...
Test that nothing happens with the vanilla config.
testBackgroundWorkloadVanillaConfig
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/background_cpu_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/background_cpu_test.py
Apache-2.0
def testBackgroundWorkloadVanillaConfigFlag(self): """Check that the background_cpu_threads flags overrides the config.""" FLAGS['background_cpu_threads'].parse(2) spec = self._CreateBenchmarkSpec(ping_benchmark.BENCHMARK_CONFIG) spec.ConstructVirtualMachines() for vm in spec.vms: self.assertE...
Check that the background_cpu_threads flags overrides the config.
testBackgroundWorkloadVanillaConfigFlag
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/background_cpu_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/background_cpu_test.py
Apache-2.0
def testBackgroundWorkloadConfig(self): """Check that the config can be used to set background_cpu_threads.""" spec = self._CreateBenchmarkSpec(CONFIG_WITH_BACKGROUND_CPU) spec.ConstructVirtualMachines() for vm in spec.vm_groups[_GROUP_1]: self.assertIsNone(vm.background_cpu_threads) for vm in...
Check that the config can be used to set background_cpu_threads.
testBackgroundWorkloadConfig
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/background_cpu_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/background_cpu_test.py
Apache-2.0
def testBackgroundWorkloadVM(self): """Check that the vm background workload calls work.""" FLAGS['background_network_mbits_per_sec'].parse(200) spec = self.makeSpec() self._CheckVMFromSpec(spec, working_groups=(_GROUP_1, _GROUP_2))
Check that the vm background workload calls work.
testBackgroundWorkloadVM
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/background_network_workload_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/background_network_workload_test.py
Apache-2.0
def testBackgroundWorkloadVanillaConfigFlag(self): """Check that the flag overrides the config.""" FLAGS['background_network_mbits_per_sec'].parse(200) spec = self.makeSpec() for vm in spec.vms: self.assertEqual(vm.background_network_mbits_per_sec, 200) self.assertEqual(vm.background_network...
Check that the flag overrides the config.
testBackgroundWorkloadVanillaConfigFlag
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/background_network_workload_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/background_network_workload_test.py
Apache-2.0
def testBackgroundWorkloadConfig(self): """Check that the config can be used to set the background iperf.""" spec = self.makeSpec(yaml_benchmark_config=CONFIG_WITH_BACKGROUND_NETWORK) for vm in spec.vm_groups[_GROUP_1]: self.assertIsNone(vm.background_network_mbits_per_sec) for vm in spec.vm_group...
Check that the config can be used to set the background iperf.
testBackgroundWorkloadConfig
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/background_network_workload_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/background_network_workload_test.py
Apache-2.0
def testBackgroundWorkloadConfigBadIp(self): """Check that the config with invalid ip type gets an error.""" config = configs.LoadConfig( CONFIG_WITH_BACKGROUND_NETWORK_BAD_IPFLAG, {}, NAME ) with self.assertRaises(errors.Config.InvalidValue): benchmark_config_spec.BenchmarkConfigSpec( ...
Check that the config with invalid ip type gets an error.
testBackgroundWorkloadConfigBadIp
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/background_network_workload_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/background_network_workload_test.py
Apache-2.0
def testBackgroundWorkloadConfigGoodIp(self): """Check that the config can be used with an internal ip address.""" spec = self.makeSpec( yaml_benchmark_config=CONFIG_WITH_BACKGROUND_NETWORK_IPFLAG ) for vm in spec.vm_groups[_GROUP_1]: self.assertIsNone(vm.background_network_mbits_per_sec) ...
Check that the config can be used with an internal ip address.
testBackgroundWorkloadConfigGoodIp
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/background_network_workload_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/background_network_workload_test.py
Apache-2.0
def testBackgroundWorkloadSpec(self): """Check that benchmark spec calls the prepare, stop, and start on vm.""" config = configs.LoadConfig(ping_benchmark.BENCHMARK_CONFIG, {}, NAME) config_spec = benchmark_config_spec.BenchmarkConfigSpec( NAME, flag_values=FLAGS, **config ) spec = benchmar...
Check that benchmark spec calls the prepare, stop, and start on vm.
testBackgroundWorkloadSpec
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/background_workload_framework_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/background_workload_framework_test.py
Apache-2.0
def testGenerateRandomDbPassword(self): """validates GenerateRandomDbPassword as per upstream requirements. The source doc https://learn.microsoft.com/en-us/sql/relational-databases/security/password-policy?view=sql-server-ver15. requires 3 out 4 of [lower, upper, digits, symbols]. This implementation...
validates GenerateRandomDbPassword as per upstream requirements. The source doc https://learn.microsoft.com/en-us/sql/relational-databases/security/password-policy?view=sql-server-ver15. requires 3 out 4 of [lower, upper, digits, symbols]. This implementation generates [lower, upper, digits] only. ...
testGenerateRandomDbPassword
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/db_util_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/db_util_test.py
Apache-2.0
def test_add_iteration_performance_duplicate_iteration(self): """Testing the scenario where a iteration with missing query is added.""" # Creating the bechmark performance b_p = agg.EdwBenchmarkPerformance( total_iterations=2, expected_queries=[Q1_NAME, Q2_NAME] ) i1_p = agg.EdwPowerIteratio...
Testing the scenario where a iteration with missing query is added.
test_add_iteration_performance_duplicate_iteration
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/edw_benchmark_results_aggregator_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/edw_benchmark_results_aggregator_test.py
Apache-2.0
def PatchCriticalObjects(retvals=None): """A context manager that patches a few critical objects with mocks.""" def ReturnVal(*unused_arg, **unused_kwargs): del unused_arg del unused_kwargs return ('', '', 0) if retvals is None else retvals.pop(0) with mock.patch( vm_util.__name__ + '.IssueCom...
A context manager that patches a few critical objects with mocks.
PatchCriticalObjects
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/gce_virtual_machine_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/gce_virtual_machine_test.py
Apache-2.0
def testImageProjectFlag(self): """Tests that custom image_project flag is supported.""" cmd, call_count = self._CreateVmCommand(image_project='bar') self.assertEqual(call_count, 1) self.assertIn('--image-project bar', cmd)
Tests that custom image_project flag is supported.
testImageProjectFlag
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/gce_virtual_machine_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/gce_virtual_machine_test.py
Apache-2.0
def testNetworkTierFlagPremium(self): """Tests that the premium network tier flag is supported.""" cmd, call_count = self._CreateVmCommand(gce_network_tier='premium') self.assertEqual(call_count, 1) self.assertIn('network-tier=PREMIUM', cmd)
Tests that the premium network tier flag is supported.
testNetworkTierFlagPremium
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/gce_virtual_machine_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/gce_virtual_machine_test.py
Apache-2.0
def testNetworkTierFlagStandard(self): """Tests that the standard network tier flag is supported.""" cmd, call_count = self._CreateVmCommand(gce_network_tier='standard') self.assertEqual(call_count, 1) self.assertIn('network-tier=STANDARD', cmd)
Tests that the standard network tier flag is supported.
testNetworkTierFlagStandard
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/gce_virtual_machine_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/gce_virtual_machine_test.py
Apache-2.0
def testNetworkInterfaceDefault(self): """Tests that gVNIC is selected as the default virtual NIC.""" cmd, call_count = self._CreateVmCommand() self.assertEqual(call_count, 1) self.assertIn('nic-type=GVNIC', cmd)
Tests that gVNIC is selected as the default virtual NIC.
testNetworkInterfaceDefault
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/gce_virtual_machine_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/gce_virtual_machine_test.py
Apache-2.0
def testNetworkInterfaceVIRTIO(self): """Tests that VirtIO can be set as the virtual NIC.""" cmd, call_count = self._CreateVmCommand(gce_nic_types=['VIRTIO_NET']) self.assertEqual(call_count, 1) self.assertIn('nic-type=VIRTIO_NET', cmd)
Tests that VirtIO can be set as the virtual NIC.
testNetworkInterfaceVIRTIO
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/gce_virtual_machine_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/gce_virtual_machine_test.py
Apache-2.0
def testNetworkInterfaceIDPF(self): """Tests that when IDPF is set the NIC type is ignored when calling the command.""" cmd, call_count = self._CreateVmCommand(gce_nic_types=['IDPF']) self.assertEqual(call_count, 1) self.assertIn('nic-type=IDPF', cmd)
Tests that when IDPF is set the NIC type is ignored when calling the command.
testNetworkInterfaceIDPF
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/gce_virtual_machine_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/gce_virtual_machine_test.py
Apache-2.0
def testMultipleNetworkInterfaces(self): """Tests that multiple network interfaces can be set.""" cmd, call_count = self._CreateVmCommand( gce_network_type='custom', gce_subnet_name=['subnet1', 'subnet2'], gce_nic_types=['GVNIC', 'VIRTIO_NET'], gce_nic_queue_counts=['default', '1...
Tests that multiple network interfaces can be set.
testMultipleNetworkInterfaces
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/gce_virtual_machine_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/gce_virtual_machine_test.py
Apache-2.0
def testEgressBandwidthTier(self): """Tests that egress bandwidth can be set as tier 1.""" cmd, call_count = self._CreateVmCommand(gce_egress_bandwidth_tier='TIER_1') self.assertEqual(call_count, 1) self.assertIn('total-egress-bandwidth-tier=TIER_1', cmd)
Tests that egress bandwidth can be set as tier 1.
testEgressBandwidthTier
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/gce_virtual_machine_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/gce_virtual_machine_test.py
Apache-2.0
def testShieldedSecureBootFlag(self): """Tests that the custom shielded secure boot flag is supported.""" cmd, call_count = self._CreateVmCommand(gce_shielded_secure_boot=True) self.assertEqual(call_count, 1) self.assertIn('--shielded-secure-boot', cmd)
Tests that the custom shielded secure boot flag is supported.
testShieldedSecureBootFlag
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/gce_virtual_machine_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/gce_virtual_machine_test.py
Apache-2.0
def runTest(self, set_files, calls): """Run a SetFiles test. Args: set_files: the value of FLAGS.set_files calls: a list of mock.call() objects giving the expected calls to vm.RemoteCommand() for the test. """ FLAGS['set_files'].parse(set_files) vm = CreateTestLinuxVm() wi...
Run a SetFiles test. Args: set_files: the value of FLAGS.set_files calls: a list of mock.call() objects giving the expected calls to vm.RemoteCommand() for the test.
runTest
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/linux_virtual_machine_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/linux_virtual_machine_test.py
Apache-2.0
def testThreadLogContextExtendLabelEmptyStrings(self): """Verify ThreadLogContext.ExtendLabel behavior with empty strings.""" context = log_util.ThreadLogContext() self.assertEqual(context.label, '') with context.ExtendLabel(''): self.assertEqual(context.label, '') with context.ExtendLabel('...
Verify ThreadLogContext.ExtendLabel behavior with empty strings.
testThreadLogContextExtendLabelEmptyStrings
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/log_util_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/log_util_test.py
Apache-2.0
def testThreadLogContextCopyConstruct(self): """Verify ThreadLogContext init with a reference ThreadLogContext behavior. The label state of the first ThreadLogContext should be copied. """ original = log_util.ThreadLogContext() self.assertEqual(original.label, '') with original.ExtendLabel('LAB...
Verify ThreadLogContext init with a reference ThreadLogContext behavior. The label state of the first ThreadLogContext should be copied.
testThreadLogContextCopyConstruct
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/log_util_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/log_util_test.py
Apache-2.0
def testRunThreadedContextCopy(self): """Verify that ThreadLogContext is copied to threads by background_tasks.RunThreaded.""" original = log_util.ThreadLogContext() log_util.SetThreadLogContext(original) t1_list = ['T1'] t2_list = ['T2'] self.assertEqual(original.label, '') with original.Ex...
Verify that ThreadLogContext is copied to threads by background_tasks.RunThreaded.
testRunThreadedContextCopy
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/log_util_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/log_util_test.py
Apache-2.0
def testPkbLogFilter(self): """Verify that PkbLogFilter sets the pkb_label of LogRecords it processes.""" logger_name = 'log_util_test.LogUtilTestCase.testPkbLogFilter' context = log_util.ThreadLogContext() log_util.SetThreadLogContext(context) with context.ExtendLabel('LABEL-A'): log_record =...
Verify that PkbLogFilter sets the pkb_label of LogRecords it processes.
testPkbLogFilter
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/log_util_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/log_util_test.py
Apache-2.0
def testPkbLogFilterNoContext(self): """Verify that PkbLogFilter works if no context was set.""" self.completed = False def childLog(): logger_name = 'log_util_test.LogUtilTestCase.testPkbLogFilterNoContext' self.log_record = logging.LogRecord( name=logger_name, level=loggin...
Verify that PkbLogFilter works if no context was set.
testPkbLogFilterNoContext
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/log_util_test.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/log_util_test.py
Apache-2.0
def __init__(self, klass): """Provide a klass to compare to. Args: klass: A class or tuple of classes to check, ie, str or (int, long). """ if ( not all(issubclass(k, object) for k in klass) if isinstance(klass, tuple) else not issubclass(klass, object) ): raise ...
Provide a klass to compare to. Args: klass: A class or tuple of classes to check, ie, str or (int, long).
__init__
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/matchers.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/matchers.py
Apache-2.0
def __init__(self, *values): """Save arguments as values to check for. Attempt to convert values to a set. If values is not hashable, store them as-is. In either case, set the hashable flag for reference when determining equality. Args: *values: A collection of values to search for. ""...
Save arguments as values to check for. Attempt to convert values to a set. If values is not hashable, store them as-is. In either case, set the hashable flag for reference when determining equality. Args: *values: A collection of values to search for.
__init__
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/matchers.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/matchers.py
Apache-2.0
def __eq__(self, collection): """Determine if all self._values are in a given collection. Args: collection: collection to search for values in. Returns: True if self._values is not empty and all self._values are in collection, False otherwise. """ if not self._values or ( ...
Determine if all self._values are in a given collection. Args: collection: collection to search for values in. Returns: True if self._values is not empty and all self._values are in collection, False otherwise.
__eq__
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/matchers.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/matchers.py
Apache-2.0
def _FuncArgCount(f, builtin=1): """Counts the number of arguments f takes. In detail, this looks for the actual implementation of f through up to (arbitrarily) 16 layers of __call__ to find its code object, then returns the number of positional arguments that code accepts. The self parameter of bound metho...
Counts the number of arguments f takes. In detail, this looks for the actual implementation of f through up to (arbitrarily) 16 layers of __call__ to find its code object, then returns the number of positional arguments that code accepts. The self parameter of bound methods is not counted, because it is bound...
_FuncArgCount
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/matchers.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/matchers.py
Apache-2.0
def __init__( self, value: Any, *, comparison: Callable[[Any, Any], bool], ): """Initializer. Args: value: Value to compare against. comparison: A binary operator, e.g., operator.lt. """ self._value = value self._comparison = comparison
Initializer. Args: value: Value to compare against. comparison: A binary operator, e.g., operator.lt.
__init__
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/matchers.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/matchers.py
Apache-2.0
def __init__(self, value: float, **kwargs: Any): """Initializer. Args: value: Value to compare against. **kwargs: Additional arguments to math.isclose(). """ self._value = value self._isclose_kwargs = kwargs
Initializer. Args: value: Value to compare against. **kwargs: Additional arguments to math.isclose().
__init__
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/matchers.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/matchers.py
Apache-2.0
def __init__(self, sequence: Sequence[float], **kwargs: Any): """Initializes the matcher with a sequence to match against. Args: sequence: Sequence to compare against. **kwargs: Additional arguments to math.isclose(). """ self._sequence = sequence self._isclose_kwargs = kwargs
Initializes the matcher with a sequence to match against. Args: sequence: Sequence to compare against. **kwargs: Additional arguments to math.isclose().
__init__
python
GoogleCloudPlatform/PerfKitBenchmarker
tests/matchers.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/tests/matchers.py
Apache-2.0