diff --git a/plugins/git4idea/src/git4idea/commands/GitCommand.java b/plugins/git4idea/src/git4idea/commands/GitCommand.java index 2528424c8d1a..11938ad7d5e2 100644 --- a/plugins/git4idea/src/git4idea/commands/GitCommand.java +++ b/plugins/git4idea/src/git4idea/commands/GitCommand.java @@ -136,4 +136,8 @@ public class GitCommand { return new GitCommand(this, LockingPolicy.READ); } + @Override + public String toString() { + return myName; + } } diff --git a/plugins/git4idea/src/git4idea/commands/GitHandler.java b/plugins/git4idea/src/git4idea/commands/GitHandler.java index c6c33d227d2d..237fe5416a43 100644 --- a/plugins/git4idea/src/git4idea/commands/GitHandler.java +++ b/plugins/git4idea/src/git4idea/commands/GitHandler.java @@ -96,6 +96,8 @@ public abstract class GitHandler { private Runnable mySuspendAction; // Suspend action used by {@link #suspendWriteLock()} private Runnable myResumeAction; // Resume action used by {@link #resumeWriteLock()} + private long myStartTime; // git execution start timestamp + /** * A constructor @@ -387,12 +389,19 @@ public abstract class GitHandler { checkNotStarted(); try { - // setup environment + myStartTime = System.currentTimeMillis(); if (!myProject.isDefault() && !mySilent && (myVcs != null)) { myVcs.showCommandLine("cd " + myWorkingDirectory); myVcs.showCommandLine(printableCommandLine()); + LOG.info("cd " + myWorkingDirectory); LOG.info(myCommandLine.getCommandLineString()); } + else { + LOG.debug("cd " + myWorkingDirectory); + LOG.debug(myCommandLine.getCommandLineString()); + } + + // setup environment if (!myNoSSHFlag && myProjectSettings.isIdeaSsh()) { GitSSHService ssh = GitSSHIdeaService.getInstance(); myEnv.put(GitSSHHandler.GIT_SSH_ENV, ssh.getScriptPath().getPath()); @@ -721,6 +730,13 @@ public abstract class GitHandler { vcs.getCommandLock().writeLock().unlock(); break; } + + if (myStartTime > 0) { + LOG.debug(String.format("git %s took %s ms", myCommand, System.currentTimeMillis() - myStartTime)); + } + else { + LOG.debug(String.format("git %s finished.", myCommand)); + } } }