mirror of
https://github.com/curl/curl.git
synced 2026-05-30 11:27:29 +03:00
scorecard: more params for upload tests
Add --upload-parallel=n for controlling upload parallelism. Make upload processing similar to download processing. Closes #19302
This commit is contained in:
parent
27f55383fb
commit
c35a87d776
1 changed files with 20 additions and 8 deletions
|
|
@ -194,6 +194,7 @@ class ScoreRunner:
|
|||
verbose: int,
|
||||
curl_verbose: int,
|
||||
download_parallel: int = 0,
|
||||
upload_parallel: int = 0,
|
||||
server_addr: Optional[str] = None,
|
||||
with_flame: bool = False,
|
||||
socks_args: Optional[List[str]] = None,
|
||||
|
|
@ -206,6 +207,7 @@ class ScoreRunner:
|
|||
self.server_port = server_port
|
||||
self._silent_curl = not curl_verbose
|
||||
self._download_parallel = download_parallel
|
||||
self._upload_parallel = upload_parallel
|
||||
self._with_flame = with_flame
|
||||
self._socks_args = socks_args
|
||||
self._limit_rate = limit_rate
|
||||
|
|
@ -472,11 +474,13 @@ class ScoreRunner:
|
|||
|
||||
def uploads(self, count: int, fsizes: List[int], meta: Dict[str, Any]) -> Dict[str, Any]:
|
||||
nsamples = meta['samples']
|
||||
max_parallel = self._download_parallel if self._download_parallel > 0 else count
|
||||
url = f'https://{self.env.domain2}:{self.server_port}/curltest/put'
|
||||
cols = ['size', 'single']
|
||||
max_parallel = self._upload_parallel if self._upload_parallel > 0 else count
|
||||
cols = ['size']
|
||||
if not self._upload_parallel:
|
||||
cols.append('single')
|
||||
if count > 1:
|
||||
cols.append(f'serial({count})')
|
||||
if count > 1:
|
||||
cols.append(f'serial({count})')
|
||||
cols.append(f'parallel({count}x{max_parallel})')
|
||||
rows = []
|
||||
for fsize in fsizes:
|
||||
|
|
@ -484,14 +488,16 @@ class ScoreRunner:
|
|||
'val': fsize,
|
||||
'sval': Card.fmt_size(fsize)
|
||||
}]
|
||||
self.info(f'{row[0]["sval"]} uploads...')
|
||||
url = f'https://{self.env.domain2}:{self.server_port}/curltest/put'
|
||||
fname = f'upload{row[0]["sval"]}.data'
|
||||
fpath = self._make_docs_file(docs_dir=self.env.gen_dir,
|
||||
fname=fname, fsize=fsize)
|
||||
|
||||
self.info(f'{row[0]["sval"]} uploads...')
|
||||
row.append(self.ul_single(url=url, fpath=fpath, nsamples=nsamples))
|
||||
if 'single' in cols:
|
||||
row.append(self.ul_single(url=url, fpath=fpath, nsamples=nsamples))
|
||||
if count > 1:
|
||||
row.append(self.ul_serial(url=url, fpath=fpath, count=count, nsamples=nsamples))
|
||||
if 'single' in cols:
|
||||
row.append(self.ul_serial(url=url, fpath=fpath, count=count, nsamples=nsamples))
|
||||
row.append(self.ul_parallel(url=url, fpath=fpath, count=count, nsamples=nsamples))
|
||||
rows.append(row)
|
||||
self.info('done.\n')
|
||||
|
|
@ -723,6 +729,7 @@ def run_score(args, protocol):
|
|||
verbose=args.verbose,
|
||||
curl_verbose=args.curl_verbose,
|
||||
download_parallel=args.download_parallel,
|
||||
upload_parallel=args.upload_parallel,
|
||||
with_flame=args.flame,
|
||||
socks_args=socks_args,
|
||||
limit_rate=args.limit_rate)
|
||||
|
|
@ -750,6 +757,7 @@ def run_score(args, protocol):
|
|||
server_port=server_port,
|
||||
verbose=args.verbose, curl_verbose=args.curl_verbose,
|
||||
download_parallel=args.download_parallel,
|
||||
upload_parallel=args.upload_parallel,
|
||||
with_flame=args.flame,
|
||||
socks_args=socks_args,
|
||||
limit_rate=args.limit_rate)
|
||||
|
|
@ -777,6 +785,7 @@ def run_score(args, protocol):
|
|||
server_port=server_port,
|
||||
verbose=args.verbose, curl_verbose=args.curl_verbose,
|
||||
download_parallel=args.download_parallel,
|
||||
upload_parallel=args.upload_parallel,
|
||||
with_flame=args.flame,
|
||||
socks_args=socks_args,
|
||||
limit_rate=args.limit_rate)
|
||||
|
|
@ -887,6 +896,9 @@ def main():
|
|||
parser.add_argument("--upload-count", action='store', type=int,
|
||||
metavar='number', default=50,
|
||||
help="perform that many uploads")
|
||||
parser.add_argument("--upload-parallel", action='store', type=int,
|
||||
metavar='number', default=0,
|
||||
help="perform that many uploads in parallel (default all)")
|
||||
|
||||
parser.add_argument("-r", "--requests", action='store_true',
|
||||
default=False, help="evaluate requests")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue