use of com.facebook.presto.execution.SqlTaskIoStats in project presto by prestodb.
the class GcStatusMonitor method logTaskStats.
private static void logTaskStats(List<QueryId> queryIds, ListMultimap<QueryId, SqlTask> tasksByQueryId) {
List<List<String>> rows = queryIds.stream().flatMap(queryId -> {
List<SqlTask> sqlTasks = tasksByQueryId.get(queryId);
Comparator<SqlTask> comparator = (first, second) -> {
TaskStats aTaskStats = first.getTaskInfo().getStats();
TaskStats bTaskStats = second.getTaskInfo().getStats();
return Long.compare(aTaskStats.getUserMemoryReservationInBytes() + aTaskStats.getSystemMemoryReservationInBytes(), bTaskStats.getUserMemoryReservationInBytes() + bTaskStats.getSystemMemoryReservationInBytes());
};
return sqlTasks.stream().sorted(comparator.reversed()).map(task -> {
TaskInfo taskInfo = task.getTaskInfo();
SqlTaskIoStats taskIOStats = task.getIoStats();
TaskStatus taskStatus = taskInfo.getTaskStatus();
TaskStats taskStats = taskInfo.getStats();
return ImmutableList.of(task.getQueryContext().getQueryId().toString(), task.getTaskId().toString(), taskStatus.getState().toString(), taskStats.getCreateTime().toString(), Long.toString(taskStats.getUserMemoryReservationInBytes()), Long.toString(taskStats.getSystemMemoryReservationInBytes()), Long.toString(taskIOStats.getInputDataSize().getTotalCount()), Long.toString(taskIOStats.getOutputDataSize().getTotalCount()), Long.toString(taskIOStats.getInputPositions().getTotalCount()), Long.toString(taskIOStats.getOutputPositions().getTotalCount()));
});
}).collect(toImmutableList());
if (!rows.isEmpty()) {
logInfoTable(ImmutableList.<List<String>>builder().add(ImmutableList.of("Query ID", "Task ID", "State", "Created Ts", "User Memory", "System Memory", "Input Bytes", "Output Bytes", "Input Row Count", "Output Row Count")).addAll(rows).build());
}
}
Aggregations