OXIESEC PANEL
- Current Dir:
/
/
opt
/
gsutil
/
gslib
/
commands
/
__pycache__
Server IP: 2a02:4780:11:1594:0:ef5:22d7:a
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/11/2025 08:19:49 AM
rwxr-xr-x
📄
__init__.cpython-39.pyc
323 bytes
02/11/2025 08:19:49 AM
rw-r--r--
📄
acl.cpython-39.pyc
18.76 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
autoclass.cpython-39.pyc
6.01 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
bucketpolicyonly.cpython-39.pyc
6.75 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
cat.cpython-39.pyc
4.17 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
compose.cpython-39.pyc
4.57 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
config.cpython-39.pyc
40.97 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
cors.cpython-39.pyc
6.56 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
cp.cpython-39.pyc
42.21 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
defacl.cpython-39.pyc
11.25 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
defstorageclass.cpython-39.pyc
5.78 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
du.cpython-39.pyc
8.47 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
hash.cpython-39.pyc
7.87 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
help.cpython-39.pyc
6.41 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
hmac.cpython-39.pyc
12.39 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
iam.cpython-39.pyc
24.6 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
kms.cpython-39.pyc
14.88 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
label.cpython-39.pyc
10.46 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
lifecycle.cpython-39.pyc
6.37 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
logging.cpython-39.pyc
9.04 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
ls.cpython-39.pyc
18.81 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
mb.cpython-39.pyc
12.23 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
mv.cpython-39.pyc
5.06 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
notification.cpython-39.pyc
25.47 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
pap.cpython-39.pyc
6.53 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
perfdiag.cpython-39.pyc
62.18 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
rb.cpython-39.pyc
3.78 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
requesterpays.cpython-39.pyc
5.53 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
retention.cpython-39.pyc
20.02 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
rewrite.cpython-39.pyc
16.12 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
rm.cpython-39.pyc
10.86 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
rpo.cpython-39.pyc
5.96 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
rsync.cpython-39.pyc
53.86 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
setmeta.cpython-39.pyc
11.25 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
signurl.cpython-39.pyc
20.99 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
stat.cpython-39.pyc
5.04 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
test.cpython-39.pyc
17.73 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
ubla.cpython-39.pyc
6.96 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
update.cpython-39.pyc
12.26 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
version.cpython-39.pyc
5.25 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
versioning.cpython-39.pyc
5.51 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
web.cpython-39.pyc
7.63 KB
02/11/2025 08:19:49 AM
rw-r--r--
Editing: perfdiag.cpython-39.pyc
Close
a +(Wg�u � @ sB d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlm Z ddl Z ddlZddlZddl Z ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZdd lmZ dd lmZ ddlmZ ddlmZ ddlZddl m!Z! dd l m"Z" ddl#m$Z$ ddl#m%Z% ddl&m'Z' ddl(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z4 ddl5m6Z6 ddl7m8Z8 ddl7m9Z9 ddl:m;Z; ddl<m=Z= ddl<m>Z> ddl?m@Z@ ddlAmBZB ddlAmCZC dd lAmDZD dd!lAmEZE dd"lAmFZF dd#lGmHZH dd$lGmIZI dd%lGmJZJ dd&lGmKZK dd'lGmLZL d(ZMd)eM d* ZNe d+d,�ZOe d-d.�ZPe d/d0�ZQe d1d2�ZRe d3d4�ZSi ZTG d5d6� d6eU�ZVG d7d8� d8eV�ZWdQd9d:�ZXdRd;d<�ZYdSd=d>�ZZdTd?d@�Z[dUdAdB�Z\dCdD� Z]dEdF� Z^G dGdH� dHe_�Z`dVdKdL�ZaG dMdN� dNe$�ZbdOdP� ZcdS )Wz%Contains the perfdiag gsutil command.� )�absolute_import)�print_function)�division)�unicode_literalsN)�defaultdict)� namedtuple)� cStringIO)�http_client)�range)�NotFoundException)�ServiceException)�Command)�DummyArgChecker)�CommandArgument)�config)�ApiSelector)�CommandException)�FilePart)�StorageUrlFromString)�storage_v1_messages)� text_util)�GetMaxRetryDelay)�ResumableThreshold)�UTF8)�GetCloudApiInstance)�GetDownloadSerializationData)�"CalculateB64EncodedMd5FromContents)�CheckFreeSpace)�GetDiskCounters)�GetFileSize)�IS_LINUX)�IsRunningInCiEnvironment)� DivideAndCeil)�HumanReadableToBytes)�MakeBitsHumanReadable)�MakeHumanReadable)� Percentilez� gsutil perfdiag [-i in.json] gsutil perfdiag [-o out.json] [-n objects] [-c processes] [-k threads] [-p parallelism type] [-y slices] [-s size] [-d directory] [-t tests] [-j ratio] gs://<bucket_name>... z <B>SYNOPSIS</B> a�! <B>DESCRIPTION</B> The ``perfdiag`` command runs a suite of diagnostic tests for a given Cloud Storage bucket. The ``bucket_name`` parameter must name an existing bucket to which the user has write permission. Several test files will be uploaded to and downloaded from this bucket. All test files will be deleted at the completion of the diagnostic if it finishes successfully. For a list of relevant permissions, see `Cloud IAM permissions for gsutil commands <https://cloud.google.com/storage/docs/access-control/iam-gsutil>`_. gsutil performance can be influenced by a number of factors originating at the client, server, or network level. Some examples include the following: + CPU speed + Available memory + The access path to the local disk + Network bandwidth + Contention and error rates along the path between gsutil and Google servers + Operating system buffering configuration + Firewalls and other network elements The `perfdiag` command is provided so that customers can run a known measurement suite when troubleshooting performance problems. <B>PROVIDING DIAGNOSTIC OUTPUT TO THE CLOUD STORAGE TEAM</B> If the Cloud Storage team asks you to run a performance diagnostic please use the following command, and email the output file (output.json) to the @google.com address provided by the Cloud Storage team: gsutil perfdiag -o output.json gs://your-bucket Additional resources for discussing ``perfdiag`` results include the `Stack Overflow tag for Cloud Storage <https://stackoverflow.com/questions/tagged/google-cloud-storage>`_ and the `gsutil GitHub repository <https://github.com/GoogleCloudPlatform/gsutil/issues>`_. <B>OPTIONS</B> -n Sets the number of objects to use when downloading and uploading files during tests. Defaults to 5. -c Sets the number of `processes <https://en.wikipedia.org/wiki/Process_(computing)>`_ to use while running throughput experiments. The default value is 1. -k Sets the number of `threads <https://en.wikipedia.org/wiki/Thread_(computing)>`_ per process to use while running throughput experiments. Each process will receive an equal number of threads. The default value is 1. NOTE: All specified threads and processes will be created, but may not by saturated with work if too few objects (specified with ``-n``) and too few components (specified with ``-y``) are specified. -p Sets the type of parallelism to be used (only applicable when threads or processes are specified and threads * processes > 1). The default is to use ``fan``. Must be one of the following: fan Use one thread per object. This is akin to using gsutil ``-m cp``, with sliced object download / parallel composite upload disabled. slice Use Y (specified with ``-y``) threads for each object, transferring one object at a time. This is akin to using parallel object download / parallel composite upload, without ``-m``. Sliced uploads not supported for s3. both Use Y (specified with ``-y``) threads for each object, transferring multiple objects at a time. This is akin to simultaneously using sliced object download / parallel composite upload and ``gsutil -m cp``. Parallel composite uploads not supported for s3. -y Sets the number of slices to divide each file/object into while transferring data. Only applicable with the slice (or both) parallelism type. The default is 4 slices. -s Sets the size (in bytes) for each of the N (set with ``-n``) objects used in the read and write throughput tests. The default is 1 MiB. This can also be specified using byte suffixes such as 500K or 1M. NOTE: these values are interpreted as multiples of 1024 (K=1024, M=1024*1024, etc.) NOTE: If ``rthru_file`` or ``wthru_file`` are performed, N (set with ``-n``) times as much disk space as specified will be required for the operation. -d Sets the directory to store temporary local files in. If not specified, a default temporary directory will be used. -t Sets the list of diagnostic tests to perform. The default is to run the ``lat``, ``rthru``, and ``wthru`` diagnostic tests. Must be a comma-separated list containing one or more of the following: lat For N (set with ``-n``) objects, write the object, retrieve its metadata, read the object, and finally delete the object. Record the latency of each operation. list Write N (set with ``-n``) objects to the bucket, record how long it takes for the eventually consistent listing call to return the N objects in its result, delete the N objects, then record how long it takes listing to stop returning the N objects. rthru Runs N (set with ``-n``) read operations, with at most C (set with -c) reads outstanding at any given time. rthru_file The same as ``rthru``, but simultaneously writes data to the disk, to gauge the performance impact of the local disk on downloads. wthru Runs N (set with ``-n``) write operations, with at most C (set with ``-c``) writes outstanding at any given time. wthru_file The same as wthru, but simultaneously reads data from the disk, to gauge the performance impact of the local disk on uploads. -m Adds metadata to the result JSON file. Multiple ``-m`` values can be specified. Example: gsutil perfdiag -m "key1:val1" -m "key2:val2" gs://bucketname Each metadata key will be added to the top-level "metadata" dictionary in the output JSON file. -o Writes the results of the diagnostic to an output file. The output is a JSON file containing system information and performance diagnostic results. The file can be read and reported later using the ``-i`` option. -i Reads the JSON output file created using the ``-o`` command and prints a formatted description of the results. -j Applies gzip transport encoding and sets the target compression ratio for the generated test files. This ratio can be an integer between 0 and 100 (inclusive), with 0 generating a file with uniform data, and 100 generating random data. When you specify the ``-j`` option, files being uploaded are compressed in-memory and on-the-wire only. See `cp -j <https://cloud.google.com/storage/docs/gsutil/commands/cp#options>`_ for specific semantics. <B>MEASURING AVAILABILITY</B> The ``perfdiag`` command ignores the boto num_retries configuration parameter. Instead, it always retries on HTTP errors in the 500 range and keeps track of how many 500 errors were encountered during the test. The availability measurement is reported at the end of the test. Note that HTTP responses are only recorded when the request was made in a single process. When using multiple processes or threads, read and write throughput measurements are performed in an external process, so the availability numbers reported won't include the throughput measurements. <B>NOTE</B> The ``perfdiag`` command runs a series of tests that collects system information, such as the following: + Retrieves requester's IP address. + Executes DNS queries to Google servers and collects the results. + Collects network statistics information from the output of ``netstat -s`` and evaluates the BIOS product name string. + If a proxy server is configured, attempts to connect to it to retrieve the location and storage class of the bucket being used for performance testing. None of this information will be sent to Google unless you proactively choose to send it. � FileDataTuplez size md5 data�FanDownloadTuplez6need_to_slice object_name file_name serialization_data�SliceDownloadTuplez<object_name file_name serialization_data start_byte end_byte�FanUploadTuplez9need_to_slice file_name object_name use_file gzip_encoded�SliceUploadTuplez@file_name object_name use_file file_start file_size gzip_encodedc @ s e Zd ZdZdS )�Errorz%Base exception class for this module.N��__name__� __module__�__qualname__�__doc__� r2 r2 �&/opt/gsutil/gslib/commands/perfdiag.pyr, 2 s r, c @ s e Zd ZdZdS )�InvalidArgumentz)Raised on invalid arguments to functions.Nr- r2 r2 r2 r3 r4 7 s r4 c C s@ t | |�}|jr&| �|j|j|j� n| �|j||j|j� dS )a Function argument to apply for performing fanned parallel downloads. Args: cls: The calling PerfDiagCommand class instance. args: A FanDownloadTuple object describing this download. thread_state: gsutil Cloud API instance to use for the operation. N)r � need_to_slice�PerformSlicedDownload�object_name� file_name�serialization_data�Download��cls�args�thread_state� gsutil_apir2 r2 r3 �_DownloadObject< s ��r@ c C s, t | |�}| �|j||j|j|j|j� dS )a Function argument to apply for performing sliced downloads. Args: cls: The calling PerfDiagCommand class instance. args: A SliceDownloadTuple object describing this download. thread_state: gsutil Cloud API instance to use for the operation. N)r r: r7 r8 r9 � start_byte�end_byter; r2 r2 r3 �_DownloadSliceM s �rC c C sN t | |�}|jr.| j|j|j|j||jd� n| j|j|j||j|jd� dS )a Function argument to apply for performing fanned parallel uploads. Args: cls: The calling PerfDiagCommand class instance. args: A FanUploadTuple object describing this upload. thread_state: gsutil Cloud API instance to use for the operation. ��gzip_encodedN)r r5 �PerformSlicedUploadr8 r7 �use_filerE �Uploadr; r2 r2 r3 � _UploadObjectZ s ��rI c C s2 t | |�}| j|j|j||j|j|j|jd� dS )a Function argument to apply for performing sliced parallel uploads. Args: cls: The calling PerfDiagCommand class instance. args: A SliceUploadTuple object describing this upload. thread_state: gsutil Cloud API instance to use for the operation. rD N)r rH r8 r7 rG � file_start� file_sizerE r; r2 r2 r3 �_UploadSliceq s �rL c C s t | |�}| �||� dS )a Function argument to apply for performing parallel object deletions. Args: cls: The calling PerfDiagCommand class instance. object_name: The object name to delete from the test bucket. thread_state: gsutil Cloud API instance to use for the operation. N)r �Delete)r<