Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ java-приложение для работы с блокировками в С
* Обновлены action-ы в gitHubActions
* Прекращена поддержка PostgreSQL версий ниже 10, удалена настройка для отображения типа процесса
* Добавлены новые столбцы `Тип ожидаемого события` и `Имя ожидаемого события`
* Исправлен подсчет процессов, теперь учитывается только уникальные pid

1.9.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ public String getBlocksRelationsString() {
.collect(Collectors.joining(","));
}

public Set<Integer> getChildrenPid() {
Set<Integer> uniqueId = new HashSet<>();
children.stream().map(e -> uniqueId.addAll(e.getChildrenPid()));
return uniqueId;
}

public int getPid() {
return pid;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ public List<DBProcess> getProcesses() {
return processes;
}

// TODO possible duplicate processes with same pid
public int getProcessesCount() {
return processes.size() + processes.stream().mapToInt(DBController::countChildren).sum();
}

private static int countChildren(DBProcess process) {
return process.getChildren().size() + process.getChildren().stream().mapToInt(DBController::countChildren).sum();
Set<Integer> uniqueIds = new HashSet<>();
processes.stream().forEach(e -> {
uniqueIds.add(e.getPid());
uniqueIds.addAll(e.getChildrenPid());
});
return uniqueIds.size();
}

public DBBlocksJournal getBlocksJournal() {
Expand Down