FreeNOS
Public Member Functions | Private Attributes
TimeCommand Class Reference
bin » sh

Measure the execution time of a program. More...

#include <TimeCommand.h>

Inheritance diagram for TimeCommand:
ShellCommand

Public Member Functions

 TimeCommand (Shell *shell)
 Constructor function. More...
 
virtual int execute (const Size nparams, const char **params)
 Executes the command. More...
 
- Public Member Functions inherited from ShellCommand
 ShellCommand (const char *name, const Size minParams=0)
 Constructor. More...
 
virtual ~ShellCommand ()
 Destructor. More...
 
const char * getName () const
 Get command name. More...
 
const char * getHelp () const
 Get command help. More...
 
Size getMinimumParams () const
 Get the minimum number of parameters required. More...
 

Private Attributes

Shellm_shell
 Shell object. More...
 

Additional Inherited Members

- Protected Attributes inherited from ShellCommand
const char * m_name
 Unique name of the command. More...
 
const char * m_help
 Command help text. More...
 
const Size m_minParams
 Minimum number of parameters required. More...
 

Detailed Description

Measure the execution time of a program.

Definition at line 37 of file TimeCommand.h.

Constructor & Destructor Documentation

◆ TimeCommand()

TimeCommand::TimeCommand ( Shell shell)

Constructor function.

Definition at line 30 of file TimeCommand.cpp.

References ShellCommand::m_help.

Member Function Documentation

◆ execute()

int TimeCommand::execute ( const Size  nparams,
const char **  params 
)
virtual

Executes the command.

Parameters
nparamsNumber of parameters given.
paramsArray of parameters.
Returns
Error code or zero on success.

Implements ShellCommand.

Definition at line 37 of file TimeCommand.cpp.

References Shell::executeInput(), EXIT_SUCCESS, m_shell, SystemClock::now(), SystemClock::printDiff(), and printf().

Field Documentation

◆ m_shell

Shell* TimeCommand::m_shell
private

Shell object.

Definition at line 58 of file TimeCommand.h.

Referenced by execute().


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