mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:47:46 +00:00
sh: Log to debugger how long command took.
This commit is contained in:
parent
9fa8324f7a
commit
d3bd4fdcfe
1 changed files with 16 additions and 0 deletions
|
@ -12,6 +12,7 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#include <AK/FileSystemPath.h>
|
#include <AK/FileSystemPath.h>
|
||||||
|
#include <LibCore/CElapsedTimer.h>
|
||||||
|
|
||||||
//#define SH_DEBUG
|
//#define SH_DEBUG
|
||||||
|
|
||||||
|
@ -338,6 +339,19 @@ private:
|
||||||
Vector<int, 32> m_fds;
|
Vector<int, 32> m_fds;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct CommandTimer {
|
||||||
|
CommandTimer()
|
||||||
|
{
|
||||||
|
timer.start();
|
||||||
|
}
|
||||||
|
~CommandTimer()
|
||||||
|
{
|
||||||
|
dbgprintf("sh: command finished in %d ms\n", timer.elapsed());
|
||||||
|
}
|
||||||
|
|
||||||
|
CElapsedTimer timer;
|
||||||
|
};
|
||||||
|
|
||||||
static int runcmd(char* cmd)
|
static int runcmd(char* cmd)
|
||||||
{
|
{
|
||||||
if (cmd[0] == 0)
|
if (cmd[0] == 0)
|
||||||
|
@ -423,6 +437,8 @@ static int runcmd(char* cmd)
|
||||||
|
|
||||||
Vector<pid_t> children;
|
Vector<pid_t> children;
|
||||||
|
|
||||||
|
CommandTimer timer;
|
||||||
|
|
||||||
for (int i = 0; i < subcommands.size(); ++i) {
|
for (int i = 0; i < subcommands.size(); ++i) {
|
||||||
auto& subcommand = subcommands[i];
|
auto& subcommand = subcommands[i];
|
||||||
Vector<const char*> argv;
|
Vector<const char*> argv;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue