projects / phoronix-test-suite.git / commitdiff
Build Results
 
Summary

Description: Unnamed repository; edit this file to name it for gitweb.
Last Change: Wed 2/3/10 13:04

Recent Commits
Time
Signed-Off By
Description
Commit Diff
Wed 2/3/10 13:04
Michael Larabel  
phoromatic: Add... 
Wed 2/3/10 12:38
Michael Larabel  
phoromatic: Add... 
Wed 2/3/10 12:27
Michael Larabel  
phoromatic: Add... 
Wed 2/3/10 9:26
Michael Larabel  
pts: Drop MD5 hashes in... 
Tue 2/2/10 23:43
Michael Larabel  
phoromatic: Add... 
Tue 2/2/10 23:35
Michael Larabel  
pts-core: Phoromatic... 
 
> --git a/CHANGE-LOG b/CHANGE-LOG
index a1e8fe0
..f76dfcd 100644
--- a/CHANGE-LOG
+++ b/CHANGE-LOG
@@ -24,+24,@@ Phoronix Test Suite (Git)
 - 
pts-coreSupport using PHPs cURL library for handling downloads when available
 
pts-coreCalculate download speeds for each test file downloadto provide estimations on future downloads for how long it may take to download
 
pts-coreDrop support for SH PTS modulessince it was rarely used and just added overhead to pts-core module architecture
+- pts-coreOnly process a PTS module API call to a module if it actually hooks into that method
 
phodeviSplit out phodevi_parser module into phodevi_linux_parserphodevi_osx_parser, and phodevi_solaris_parser for OS-specific functions
 
phodeviAvoid situations of the manufacturer/vendor string being repeated in the motherboard property
 
phodeviAdd device notes and special settings string functionality to API
diff 
--git a/documentation/writing_your_first_module.html b/documentation/writing_your_first_module.html
index 111dea1
..9c38a15 100644
--- a/documentation/writing_your_first_module.html
+++ b/documentation/writing_your_first_module.html
@@ -14,34 +14,20 @@
 <
div style="width: 1px; height: 20px;"></div>
 <
p>Writing a module for the Phoronix Test Suite allows new functionality to be added
 without having to extensively learn how pts
-core functionsThe module framework
-for the Phoronix Test Suite allows modules to be written either as a shell script
-or as a PHP objectExample PTS modules could include a module to shutdown the
+for the Phoronix Test Suite allows modules to be written either as a PHP objectExample PTS modules could include a module to shutdown the
 screensaver when the Phoronix Test Suite starts up 
and re-enabling it when the
 test is over
using sendmail to forward the results to an e-mail address when
 testing is completed
, or writing the current test status to a LCDproc-enabled
 VFD display
.</p>
-<
p>Both PHP and SH modules are stored in <em>pts-core/modules/</em>. Loading a
+<p>Modules are stored in <em>pts-core/modules/</em>. Loading a
 module is done by either setting the 
<em>PTS_MODULES</emenvironmental variable
-with the name of the module (excluding the <em>.sh</em> or <em>.php</emfile
-extension) or by associating a module with a separate environmental variable.
-
The list of these environmental variables for auto-loading modules is stored in <em>pts-core/static/module-variables.txt</em>.
-
The name of the environmental variable starts the line followed by an equal sign
-(<em>=</em>) and then what module to load if the variable is set. For example,
-if <
em>module-variables.txt</emcontained a line that read <em>EMAIL_RESULTS_TO=email_results</em>,
-and 
the following command was run <em>EMAIL_RESULTS_TO=my-email-address@my-domain.com
-phoronix-test-suite benchmark universe</em>, it would automatically load the <em>email_results</em>
-
module and the <em>EMAIL_RESULTS_TO</emvariable could be read by this module
-using a conventional method for reading the variable.</p>
-<
p>If you plan to permanently use a modulethe string that normally would be
-defined in <em>PTS_MODULES</emcan be set within the <em>LoadModules</emtag
-found in <em>~/.phoronix-test-suite/user-config.xml</em>. Multiple modules can
-be loaded simultaneously using the <em>PTS_MODULES</emvariable or <em>LoadModules</em>
-
tag by delimiting each command with a comma (<em>,</em>).</p>
+
with the name of the module (excluding the <em>.php</emfile
+extension) or by associating a module with a separate environmental variableThe default list of modules to be loaded is stored in <em>~/.phoronix-test-suite/user-config.xml</em>.</p>
 <
p>NoteTo run through all of the function calls for a module without needing to run a test,
 
run <em>phoronix-test-suite test-module MODULE_NAME</em>. Additionallyrunning
 
<em>phoronix-test-suite debug-module MODULE_NAME</emwill yield additional debugging details while
 
executing the same process.</p>
-<
h1>PHP Module</h1>
+<
h1>Module</h1>
 <
p>To see all of the functions supported for modules written in PHPlook at <em>pts-core/modules/dummy_module.php</em>
 and 
additionally the other .php modules that ship with the Phoronix Test Suite.
 
Additionallythere are several functions written specifically for Phoronix Test
@@ -81,47 +67,@@ class time_me extends pts_module_interface<br />
 <
p>Then by running <em>PTS_MODULES=time_me phoronix-test-suite benchmark video-extensions</em>,
 
at the end of the test it would print a string similar to: &quot;The Phoronix
 Test Suite Ran 
For 52 Seconds.&quot;</p>
-<
p>Running phoronix-test-suite module-info time_me would produce the following
-text.</p>
-<
blockquote>====================================<br>
-
ModuleTime Me!<br>
-====================================</
p>
-<
p>Version1.0.0<br>
-
AuthorPhoronix Media<br>
-
DescriptionThis is a module that times how long the Phoronix Test Suite runs.</blockquote>
-<
h1>Shell Script Modules</h1>
-<
p>Writing Phoronix Test Suite modules in PHP is the preferred methodbut the
-programming model for a shell script is similarLook at <em>dummy_script_module.sh</em>
-
to see available optionsBelow is a .sh version of the <em>time_me.php</emmodule
-showcased in the previous sectionThis <em>time_me.sh</emmodule provides the
-same exact functionality as the PHP version.</p>
-<
blockquote>#!/bin/sh<br />
-case $1 in<br />
- &
nbsp; &nbsp"module_name")<br />
- &
nbsp; &nbsp;  &nbsp; &nbsp; echo "Time Me!"<br />
- &
nbsp; &nbsp; ;;<br />
- &
nbsp; &nbsp"module_version")<br />
- &
nbsp; &nbsp;  &nbsp; &nbsp; echo "1.0.0"<br />
- &
nbsp; &nbsp; ;;<br />
- &
nbsp; &nbsp"module_description")<br />
- &
nbsp; &nbsp;  &nbsp; &nbsp; echo "This is a module that times how long the Phoronix Test Suite runs."<br />
- &
nbsp; &nbsp; ;;<br />
- &
nbsp; &nbsp"module_author")<br />
- &
nbsp; &nbsp;  &nbsp; &nbsp; echo "Phoronix Media"<br />
- &
nbsp; &nbsp; ;;<br />
- &
nbsp; &nbsp"__startup")<br />
- &
nbsp; &nbsp;  &nbsp; &nbspdate +%> /tmp/pts-start-timer<br />
- &
nbsp; &nbsp; ;;<br />
- &
nbsp; &nbsp"__shutdown")<br />
- &
nbsp; &nbsp;  &nbsp; &nbspdate +%> /tmp/pts-end-timer<br />
- &
nbsp; &nbsp;  &nbsp; &nbspSTART_TIME=`cat /tmp/pts-start-timer`<br />
- &
nbsp; &nbsp;  &nbsp; &nbspEND_TIME=`cat /tmp/pts-end-timer`<br />
- &
nbsp; &nbsp;  &nbsp; &nbspTIME_ELAPSED=`expr $END_TIME - $START_TIME`<br />
- &
nbsp; &nbsp;  &nbsp; &nbsp; echo "\nThe Phoronix Test Suite Ran For $TIME_ELAPSED Seconds.\n";<br />
- &
nbsp; &nbsp;  &nbsp; &nbsprm -/tmp/pts-start-timer<br />
- &
nbsp; &nbsp;  &nbsp; &nbsprm -/tmp/pts-end-timer<br />
- &
nbsp; &nbsp; ;;<br />
-
esac</blockquote>
 <!-- 
END OF PTS AREA -->
 </
div></div><div class="pts_doc_fixed"><div class="pts_doc_bottom"><div style="float: left;"><a href="http://www.phoronix-test-suite.com/">Phoronix-Test-Suite.com</a></div><div style="float: right;">Copyright &copy2008 by <a href="http://www.phoronix-media.com/">Phoronix Media</a>.</div></div></div>
 </
body>
diff --git a/pts-core/library/pts-functions_modules.php b/pts-core/library/pts-functions_modules.php
index bdb7735
..2fb002b 100644
--- a/pts-core/library/pts-functions_modules.php
+++ b/pts-core/library/pts-functions_modules.php
@@ -226,+226,@@ function pts_module_call($module$process, &$object_pass null)
 function 
pts_module_process($process, &$object_pass null)
 {
     
// Run a module process on all registered modules
-    foreach(pts_module_manager::attached_modules() as $module)
+    foreach(
pts_module_manager::attached_modules($process) as $module)
     {
         
pts_module_process_task($module$process$object_pass);
     }
diff --git a/pts-core/objects/pts_module_interface.php b/pts-core/objects/pts_module_interface.php
index 62aae74
..193bc39 100644
--- a/pts-core/objects/pts_module_interface.php
+++ b/pts-core/objects/pts_module_interface.php
@@ -48,+48,12 @@ class pts_module_interface
     
}

     
//
+    // The below methods are optional and can be implemented by any module
+    //
+
+    
/*
+
+    //
     // General Functions
     //

@@ -166,6 +172,8 @@ class pts_module_interface
         // Passed is a read-only copy of the pts_user_error object
         return;
     }
+
+    */
 
}

 
?>
diff --git a/pts-core/objects/pts_module_manager.php b/pts-core/objects/pts_module_manager.php
index 26b0f9b..2e2def5 100644
--- a/pts-core/objects/pts_module_manager.php
+++ b/pts-core/objects/pts_module_manager.php
@@ -24,6 +24,7 @@ class pts_module_manager
 {
     private static $modules = array();
     private static $var_storage = array();
+    private static $module_process = array();
     private static $current_module = null;

     //
@@ -33,6 +34,19 @@ class pts_module_manager
     public static function attach_module($module)
     {
         array_push(self::$modules, $module);
+
+        if(class_exists($module))
+        {
+            foreach(get_class_methods($module) as $module_method)
+            {
+                if(!is_array(self::$module_process[$module_method]))
+                {
+                    self::$module_process[$module_method] = array();
+                }
+
+                array_push(self::$module_process[$module_method], $module);
+            }
+        }
     }
     public static function detach_module($module)
     {
@@ -41,9 +55,9 @@ class pts_module_manager
             unset(self::$modules[$module]);
         }
     }
-    public static function attached_modules()
+    public static function attached_modules($process_name = null)
     {
-        return self::$modules;
+        return $process_name == null ? self::$modules : (isset(self::$module_process[$process_name]) ? self::$module_process[$process_name] : array());
     }
     public static function is_module_attached($module)
&nb
 
Phoronix.com
Linux Driver Forums
Copyright © 2010 by Phoronix Media