| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* ApacheBench installation and database schema.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Implementation of hook_install().
|
| 11 |
*/
|
| 12 |
function ab_install() {
|
| 13 |
drupal_install_schema('ab');
|
| 14 |
}
|
| 15 |
|
| 16 |
/**
|
| 17 |
* Implementation of hook_schema().
|
| 18 |
*/
|
| 19 |
function ab_schema() {
|
| 20 |
$schema = array();
|
| 21 |
|
| 22 |
$schema['ab_results'] = array(
|
| 23 |
'description' => t('Results of ab invocation stored for reporting usage.'),
|
| 24 |
'fields' => array(
|
| 25 |
'rid' => array(
|
| 26 |
'description' => t('Primary identifier for this report.'),
|
| 27 |
'type' => 'serial',
|
| 28 |
'unsigned' => TRUE,
|
| 29 |
'not null' => TRUE),
|
| 30 |
'uri' => array(
|
| 31 |
'description' => t('URI tested against.'),
|
| 32 |
'type' => 'varchar',
|
| 33 |
'length' => 255,
|
| 34 |
'default' => ''),
|
| 35 |
'requests_per_second' => array(
|
| 36 |
'description' => t('Total requests per second.'),
|
| 37 |
'type' => 'int',
|
| 38 |
'unsigned' => TRUE,
|
| 39 |
'not null' => TRUE,
|
| 40 |
'default' => 0),
|
| 41 |
'document_length' => array(
|
| 42 |
'description' => t('Length of document in bytes.'),
|
| 43 |
'type' => 'int',
|
| 44 |
'unsigned' => TRUE,
|
| 45 |
'not null' => TRUE,
|
| 46 |
'default' => 0),
|
| 47 |
'time_taken_for_tests' => array(
|
| 48 |
'description' => t('Total time taken in seconds.'),
|
| 49 |
'type' => 'float',
|
| 50 |
'precision' => 10,
|
| 51 |
'scale' => 3,
|
| 52 |
'not null' => TRUE,
|
| 53 |
'default' => 0),
|
| 54 |
'complete_requests' => array(
|
| 55 |
'description' => t('Number of completed requests.'),
|
| 56 |
'type' => 'int',
|
| 57 |
'unsigned' => TRUE,
|
| 58 |
'not null' => FALSE,
|
| 59 |
'default' => 0),
|
| 60 |
'failed_requests' => array(
|
| 61 |
'description' => t('Number of failed requests.'),
|
| 62 |
'type' => 'int',
|
| 63 |
'unsigned' => TRUE,
|
| 64 |
'not null' => FALSE,
|
| 65 |
'default' => 0),
|
| 66 |
'total_transferred' => array(
|
| 67 |
'description' => t('Number of bytes transfered.'),
|
| 68 |
'type' => 'int',
|
| 69 |
'unsigned' => TRUE,
|
| 70 |
'not null' => FALSE,
|
| 71 |
'default' => 0),
|
| 72 |
'html_transferred' => array(
|
| 73 |
'description' => t('Number of bytes HTML transfered.'),
|
| 74 |
'type' => 'int',
|
| 75 |
'unsigned' => TRUE,
|
| 76 |
'not null' => FALSE,
|
| 77 |
'default' => 0),
|
| 78 |
'concurrency' => array(
|
| 79 |
'description' => t('Concurrency of requests.'),
|
| 80 |
'type' => 'int',
|
| 81 |
'unsigned' => TRUE,
|
| 82 |
'not null' => FALSE,
|
| 83 |
'default' => 0),
|
| 84 |
'requests' => array(
|
| 85 |
'description' => t('Total number of requests.'),
|
| 86 |
'type' => 'int',
|
| 87 |
'unsigned' => TRUE,
|
| 88 |
'not null' => FALSE,
|
| 89 |
'default' => 0),
|
| 90 |
'created' => array(
|
| 91 |
'description' => t('The Unix timestamp when the row was created.'),
|
| 92 |
'type' => 'int',
|
| 93 |
'not null' => TRUE,
|
| 94 |
'default' => 0),
|
| 95 |
),
|
| 96 |
'indexes' => array(
|
| 97 |
'uri' => array('uri'),
|
| 98 |
'requests_per_second' => array('requests_per_second'),
|
| 99 |
'concurrency' => array('concurrency'),
|
| 100 |
'requests' => array('requests'),
|
| 101 |
'document_length' => array('document_length'),
|
| 102 |
'time_taken_for_tests' => array('time_taken_for_tests'),
|
| 103 |
'complete_requests' => array('complete_requests'),
|
| 104 |
'failed_requests' => array('failed_requests'),
|
| 105 |
'total_transferred' => array('total_transferred'),
|
| 106 |
'html_transferred' => array('html_transferred'),
|
| 107 |
'created' => array('created'),
|
| 108 |
'uri_created' => array('uri', 'created'),
|
| 109 |
),
|
| 110 |
'primary key' => array('rid'),
|
| 111 |
);
|
| 112 |
|
| 113 |
return $schema;
|
| 114 |
}
|
| 115 |
|