Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
tool_generator_testplan_backend Class Reference

Generates the files required by JMeter. More...

Inheritance diagram for tool_generator_testplan_backend:
tool_generator_backend

Public Member Functions

 dot (int $number, int $total)
 Outputs dots.
 
 end_log ()
 Ends a log string that was started using log function with $leaveopen.
 
 log (string $langstring, $a=null, bool $leaveopen=false, string $module='tool_generator')
 Displays information as part of progress.
 

Static Public Member Functions

static create_testplan_file ($courseid, $size)
 Creates the test plan file.
 
static create_users_file ($courseid, $updateuserspassword, ?int $size=null)
 Creates the users data file.
 
static get_repourl ()
 Getter for moodle-performance-comparison project URL.
 
static get_size_choices ()
 Gets a list of size choices supported by this backend.
 
static has_selected_course_any_problem ($course, $size)
 Checks if the selected target course is ok.
 
static size_for_name ($sizename)
 Converts a size name into the numeric constant.
 

Public Attributes

int const DEFAULT_SIZE = 3
 Default size index.
 
int const MAX_SIZE = 5
 Highest (largest) size index.
 
int const MIN_SIZE = 0
 Lowest (smallest) size index.
 

Static Protected Member Functions

static generate_test_plan ($targetcourseid, $size)
 Generates the test plan according to the target course contents.
 
static generate_users_file ($targetcourseid, $updateuserspassword, ?int $size=null)
 Generates the user's credentials file with all the course's users.
 
static get_course_test_data ($targetcourseid)
 Gets the data required to fill the test plan template with the database contents.
 
static get_file_record ($filearea, $filetype)
 Returns a tool_generator file record.
 

Protected Attributes

string object array int $aparam
 Optional language string parameters.
 
int bool $filesizelimit
 Maximum number of bytes for file.
 
bool $fixeddataset
 True if we want a fixed dataset or false to generate random data.
 
string $langstring
 Part of the language string.
 
string $module
 Module for the language string.
 
bool $progress
 True if displaying progress.
 
progress_bar $progressbar
 progressbar
 
int $size
 Size code (index in the above arrays)
 
int $starttime
 Epoch time at which current step (current set of dots) started.
 

Static Protected Attributes

static Number $loops = array(5, 5, 5, 6, 6, 7)
 of loops depending on the selected size.
 
static Rampup $rampups = array(1, 6, 40, 100, 500, 800)
 period depending on the selected size.
 
static The $repourl = 'https://github.com/moodlehq/moodle-performance-comparison'
 URL to the repository of the external project.
 
static Number $users = array(1, 30, 100, 1000, 5000, 10000)
 of users depending on the selected size.
 

Detailed Description

Generates the files required by JMeter.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ create_testplan_file()

static tool_generator_testplan_backend::create_testplan_file ( $courseid,
$size )
static

Creates the test plan file.

Parameters
int$courseidThe target course id
int$sizeThe test plan size
Return values
stored_file

◆ create_users_file()

static tool_generator_testplan_backend::create_users_file ( $courseid,
$updateuserspassword,
?int $size = null )
static

Creates the users data file.

Parameters
int$courseidThe target course id
bool$updateuserspasswordUpdates the course users password to $CFG->tool_generator_users_password
int | null$sizeof the test plan. Used to limit the number of users exported to match the threads in the plan. For BC, defaults to null that means all enrolled users.
Return values
stored_file

◆ dot()

tool_generator_backend::dot ( int $number,
int $total )
inherited

Outputs dots.

There is up to one dot per second. Once a minute, it displays a percentage.

Parameters
int$numberNumber of completed items
int$totalTotal number of items to complete

◆ generate_test_plan()

static tool_generator_testplan_backend::generate_test_plan ( $targetcourseid,
$size )
staticprotected

Generates the test plan according to the target course contents.

Parameters
int$targetcourseidThe target course id
int$sizeThe test plan size
Return values
stringThe test plan as a string

◆ generate_users_file()

static tool_generator_testplan_backend::generate_users_file ( $targetcourseid,
$updateuserspassword,
?int $size = null )
staticprotected

Generates the user's credentials file with all the course's users.

Parameters
int$targetcourseid
bool$updateuserspasswordUpdates the course users password to $CFG->tool_generator_users_password
int | null$sizeof the test plan. Used to limit the number of users exported to match the threads in the plan. For BC, defaults to null that means all enrolled users.
Return values
stringThe users csv file contents.

◆ get_course_test_data()

static tool_generator_testplan_backend::get_course_test_data ( $targetcourseid)
staticprotected

Gets the data required to fill the test plan template with the database contents.

Parameters
int$targetcourseidThe target course id
Return values
stdClassThe ids required by the test plan

◆ get_file_record()

static tool_generator_testplan_backend::get_file_record ( $filearea,
$filetype )
staticprotected

Returns a tool_generator file record.

Parameters
string$fileareatestplan or users
string$filetypeThe file extension jmx or csv
Return values
stdClassThe file record to use when creating tool_generator files

◆ get_repourl()

static tool_generator_testplan_backend::get_repourl ( )
static

Getter for moodle-performance-comparison project URL.

Return values
string

◆ get_size_choices()

static tool_generator_testplan_backend::get_size_choices ( )
static

Gets a list of size choices supported by this backend.

Return values
arrayList of size (int) => text description for display

◆ has_selected_course_any_problem()

static tool_generator_testplan_backend::has_selected_course_any_problem ( $course,
$size )
static

Checks if the selected target course is ok.

Parameters
int | string$course
int$size
Return values
arrayErrors array or false if everything is ok

◆ log()

tool_generator_backend::log ( string $langstring,
$a = null,
bool $leaveopen = false,
string $module = 'tool_generator' )
inherited

Displays information as part of progress.

Parameters
string$langstringPart of langstring (after progress_)
mixed$aOptional lang string parameters
bool$leaveopenIf true, doesn't close LI tag (ready for dots)
string$modulemodule for language string

◆ size_for_name()

static tool_generator_backend::size_for_name ( $sizename)
staticinherited

Converts a size name into the numeric constant.

Parameters
string$sizenameSize name e.g. 'L'
Return values
intNumeric version
Exceptions
coding_exceptionIf the size name is not known

The documentation for this class was generated from the following file: