use of com.intellij.internal.statistic.persistence.CollectedUsages in project intellij-community by JetBrains.
the class AbstractApplicationUsagesCollector method getApplicationUsages.
@NotNull
public Set<UsageDescriptor> getApplicationUsages(@NotNull ApplicationStatisticsPersistence persistence) {
ObjectIntHashMap<String> result = new ObjectIntHashMap<>();
long lastTimeSent = UsageStatisticsPersistenceComponent.getInstance().getLastTimeSent();
for (CollectedUsages usageDescriptors : persistence.getApplicationData(getGroupId()).values()) {
if (!usageDescriptors.usages.isEmpty() && usageDescriptors.collectionTime > lastTimeSent) {
result.ensureCapacity(usageDescriptors.usages.size());
for (UsageDescriptor usageDescriptor : usageDescriptors.usages) {
String key = usageDescriptor.getKey();
result.put(key, result.get(key, 0) + usageDescriptor.getValue());
}
}
}
if (result.isEmpty()) {
return Collections.emptySet();
} else {
final THashSet<UsageDescriptor> descriptors = new THashSet<>(result.size());
result.forEachEntry(new TObjectIntProcedure<String>() {
@Override
public boolean execute(String key, int value) {
descriptors.add(new UsageDescriptor(key, value));
return true;
}
});
return descriptors;
}
}
Aggregations