aboutsummaryrefslogtreecommitdiff
path: root/zen/cmds/top.cpp
blob: 5bb11d0a0e821633aed038112f0b010b9e4c8e71 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright Epic Games, Inc. All Rights Reserved.

#include "top.h"

#include <zencore/logging.h>
#include <zenserverprocess.h>

#include <memory>

//////////////////////////////////////////////////////////////////////////

TopCommand::TopCommand()
{
}

TopCommand::~TopCommand() = default;

int
TopCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
{
	ZEN_UNUSED(GlobalOptions, argc, argv);

	ZenServerState State;
	if (!State.InitializeReadOnly())
	{
		ZEN_INFO("no Zen state found");
	}

	State.Snapshot([&](const ZenServerState::ZenServerEntry& Entry) { ZEN_INFO("Port {} : pid {}", Entry.ListenPort, Entry.Pid); });

	return 0;
}

//////////////////////////////////////////////////////////////////////////

PsCommand::PsCommand()
{
}

PsCommand::~PsCommand() = default;

int
PsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
{
	ZEN_UNUSED(GlobalOptions, argc, argv);

	ZenServerState State;
	if (!State.InitializeReadOnly())
	{
		ZEN_INFO("no Zen state found");
	}

	State.Snapshot([&](const ZenServerState::ZenServerEntry& Entry) { ZEN_INFO("Port {} : pid {}", Entry.ListenPort, Entry.Pid); });

	return 0;
}