mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-08 17:47:18 +00:00
sh: Log to debugger how long command took.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <AK/FileSystemPath.h>
|
||||
#include <LibCore/CElapsedTimer.h>
|
||||
|
||||
//#define SH_DEBUG
|
||||
|
||||
@@ -338,6 +339,19 @@ private:
|
||||
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)
|
||||
{
|
||||
if (cmd[0] == 0)
|
||||
@@ -423,6 +437,8 @@ static int runcmd(char* cmd)
|
||||
|
||||
Vector<pid_t> children;
|
||||
|
||||
CommandTimer timer;
|
||||
|
||||
for (int i = 0; i < subcommands.size(); ++i) {
|
||||
auto& subcommand = subcommands[i];
|
||||
Vector<const char*> argv;
|
||||
|
||||
Reference in New Issue
Block a user