Search in sources :

Example 21 with UsageDescriptor

use of com.intellij.internal.statistic.beans.UsageDescriptor in project intellij-community by JetBrains.

the class SvnWorkingCopyFormatUsagesCollector method getProjectUsages.

@NotNull
public Set<UsageDescriptor> getProjectUsages(@NotNull Project project) {
    SvnVcs vcs = SvnVcs.getInstance(project);
    // do not track roots with errors (SvnFileUrlMapping.getErrorRoots()) as they are "not usable" until errors are resolved
    // skip externals and switched directories as they will have the same format
    List<RootUrlInfo> roots = ContainerUtil.filter(vcs.getSvnFileUrlMapping().getAllWcInfos(), info -> info.getType() == null || NestedCopyType.inner.equals(info.getType()));
    return ContainerUtil.map2Set(roots, info -> new UsageDescriptor(info.getFormat().toString(), 1));
}
Also used : RootUrlInfo(org.jetbrains.idea.svn.RootUrlInfo) UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) SvnVcs(org.jetbrains.idea.svn.SvnVcs) NotNull(org.jetbrains.annotations.NotNull)

Example 22 with UsageDescriptor

use of com.intellij.internal.statistic.beans.UsageDescriptor in project intellij-community by JetBrains.

the class VcsLogRepoSizeCollector method getProjectUsages.

@NotNull
@Override
public Set<UsageDescriptor> getProjectUsages(@NotNull Project project) throws CollectUsagesException {
    VcsProjectLog projectLog = VcsProjectLog.getInstance(project);
    VcsLogData logData = projectLog.getDataManager();
    if (logData != null) {
        DataPack dataPack = logData.getDataPack();
        if (dataPack.isFull()) {
            PermanentGraph<Integer> permanentGraph = dataPack.getPermanentGraph();
            MultiMap<VcsKey, VirtualFile> groupedRoots = groupRootsByVcs(dataPack.getLogProviders());
            Set<UsageDescriptor> usages = ContainerUtil.newHashSet();
            usages.add(StatisticsUtilKt.getCountingUsage("data.commit.count", permanentGraph.getAllCommits().size(), asList(0, 1, 100, 1000, 10 * 1000, 100 * 1000, 500 * 1000, 1000 * 1000)));
            usages.add(StatisticsUtilKt.getCountingUsage("data.branches.count", dataPack.getRefsModel().getBranches().size(), asList(0, 1, 10, 50, 100, 500, 1000, 5 * 1000, 10 * 1000, 20 * 1000, 50 * 1000)));
            usages.add(StatisticsUtilKt.getCountingUsage("data.users.count", logData.getAllUsers().size(), asList(0, 1, 10, 50, 100, 500, 1000, 5 * 1000, 10 * 1000, 20 * 1000, 50 * 1000)));
            for (VcsKey vcs : groupedRoots.keySet()) {
                usages.add(StatisticsUtilKt.getCountingUsage("data." + vcs.getName().toLowerCase() + ".root.count", groupedRoots.get(vcs).size(), asList(0, 1, 2, 5, 8, 15, 30, 50, 100, 300, 500)));
            }
            return usages;
        }
    }
    return Collections.emptySet();
}
Also used : VcsKey(com.intellij.openapi.vcs.VcsKey) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VcsLogData(com.intellij.vcs.log.data.VcsLogData) VcsProjectLog(com.intellij.vcs.log.impl.VcsProjectLog) DataPack(com.intellij.vcs.log.data.DataPack) UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) NotNull(org.jetbrains.annotations.NotNull)

Example 23 with UsageDescriptor

use of com.intellij.internal.statistic.beans.UsageDescriptor in project intellij-community by JetBrains.

the class LibraryJarUsagesCollector method getProjectUsages.

@NotNull
@Override
public Set<UsageDescriptor> getProjectUsages(@NotNull final Project project) throws CollectUsagesException {
    final LibraryJarDescriptor[] descriptors = LibraryJarStatisticsService.getInstance().getTechnologyDescriptors();
    final Set<UsageDescriptor> result = new HashSet<>(descriptors.length);
    ApplicationManager.getApplication().runReadAction(() -> {
        for (LibraryJarDescriptor descriptor : descriptors) {
            String className = descriptor.myClass;
            if (className == null)
                continue;
            PsiClass[] psiClasses = JavaPsiFacade.getInstance(project).findClasses(className, ProjectScope.getLibrariesScope(project));
            for (PsiClass psiClass : psiClasses) {
                if (psiClass == null)
                    continue;
                VirtualFile jarFile = JarFileSystem.getInstance().getLocalVirtualFileFor(psiClass.getContainingFile().getVirtualFile());
                if (jarFile == null)
                    continue;
                String version = getVersionByJarManifest(jarFile);
                if (version == null) {
                    version = getVersionByJarFileName(jarFile.getName());
                }
                if (version == null || !StringUtil.containsChar(version, '.')) {
                    continue;
                }
                result.add(new UsageDescriptor(descriptor.myName + "_" + version, 1));
            }
        }
    });
    return result;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) PsiClass(com.intellij.psi.PsiClass) UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) HashSet(com.intellij.util.containers.hash.HashSet) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

UsageDescriptor (com.intellij.internal.statistic.beans.UsageDescriptor)23 NotNull (org.jetbrains.annotations.NotNull)19 HashSet (com.intellij.util.containers.HashSet)4 HashSet (java.util.HashSet)4 GroupDescriptor (com.intellij.internal.statistic.beans.GroupDescriptor)3 Module (com.intellij.openapi.module.Module)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 HashSet (com.intellij.util.containers.hash.HashSet)2 VcsProjectLog (com.intellij.vcs.log.impl.VcsProjectLog)2 THashSet (gnu.trove.THashSet)2 Set (java.util.Set)2 CodeInsightSettings (com.intellij.codeInsight.CodeInsightSettings)1 RunManager (com.intellij.execution.RunManager)1 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)1 ConfigurationFactory (com.intellij.execution.configurations.ConfigurationFactory)1 ConfigurationType (com.intellij.execution.configurations.ConfigurationType)1 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)1 AbstractApplicationUsagesCollector (com.intellij.internal.statistic.AbstractApplicationUsagesCollector)1 CollectedUsages (com.intellij.internal.statistic.persistence.CollectedUsages)1 EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)1