@@ -0,0 +1,2198 @@
+/*%0A * Copyright 2000-2013 JetBrains s.r.o.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.jetbrains.plugins.groovy.util;%0A%0Aimport com.intellij.util.containers.ConcurrentHashMap;%0A%0Aimport java.io.FileWriter;%0Aimport java.io.IOException;%0Aimport java.util.Map;%0A%0A/**%0A * @author Max Medvedev%0A */%0Apublic class ResolveProfiler %7B%0A  private static final ThreadLocal%3CString%3E prefix = new ThreadLocal%3CString%3E();%0A%0A  private static final Map%3CThread, String%3E threadMap = new ConcurrentHashMap%3CThread, String%3E();%0A  private static volatile int fileCount = 0;%0A%0A  public static void start() %7B%0A    final String cur = prefix.get();%0A    if (cur == null) %7B%0A      prefix.set(%22  %22);%0A    %7D%0A    else %7B%0A      prefix.set(%22  %22 + cur);%0A    %7D%0A  %7D%0A%0A  public static void finish() %7B%0A    final String cur = prefix.get();%0A    if (cur == null) %7B%0A      assert false;%0A    %7D%0A    else %7B%0A      prefix.set(cur.substring(2));%0A    %7D%0A  %7D%0A%0A  public static void write(String s) %7B%0A    String name = getName();%0A    try %7B%0A      final FileWriter writer = new FileWriter(name, true);%0A      try %7B%0A        writer.write(prefix.get());%0A        writer.write(s);%0A        writer.write('%5Cn');%0A      %7D%0A      finally %7B%0A        writer.close();%0A      %7D%0A    %7D%0A    catch (IOException e) %7B%0A      e.printStackTrace();%0A    %7D%0A%0A    if (prefix.get().length() == 0) %7B%0A      synchronized (ResolveProfiler.class) %7B%0A        threadMap.remove(Thread.currentThread());%0A      %7D%0A    %7D%0A  %7D%0A%0A  private synchronized static String getName() %7B%0A    String name = threadMap.get(Thread.currentThread());%0A    if (name == null) %7B%0A      name = %22out%22 + fileCount + %22.txt%22;%0A      fileCount++;%0A      threadMap.put(Thread.currentThread(), name);%0A    %7D%0A    return name;%0A  %7D%0A%7D%0A

resolve profiler