Search in sources :

Example 1 with VirtualMachine

use of com.insightfullogic.honest_profiler.core.sources.VirtualMachine in project honest-profiler by jvm-profiling-tools.

the class MachinePicker method handleInput.

@Override
public void handleInput(int input) {
    if (isDigit(input)) {
        try {
            int index = Character.getNumericValue(input);
            System.out.println(input);
            System.out.println(index);
            VirtualMachine machine = machines.get(index);
            terminal.display(new ProfileScreen(machine, this, terminal));
        } catch (IndexOutOfBoundsException e) {
        // Just ignore numbers out of the range
        }
    }
}
Also used : VirtualMachine(com.insightfullogic.honest_profiler.core.sources.VirtualMachine)

Example 2 with VirtualMachine

use of com.insightfullogic.honest_profiler.core.sources.VirtualMachine in project honest-profiler by jvm-profiling-tools.

the class AgentIntegrationTest method discoverVirtualMachines.

private AtomicReference<Profile> discoverVirtualMachines() {
    AtomicReference<Profile> lastProfile = new AtomicReference<>();
    parkNanos(SECONDS.toNanos(1));
    new LocalMachineSource(logger, new MachineListener() {

        @Override
        public void onNewMachine(final VirtualMachine machine) {
            if (machine.isAgentLoaded()) {
                final FileLogSource logSource = (FileLogSource) machine.getLogSource();
                file.set(logSource);
                Monitor.pipeFile(logSource, lastProfile::set);
            }
        }

        @Override
        public void onClosedMachine(final VirtualMachine machine) {
        }
    }).discoverVirtualMachines();
    return lastProfile;
}
Also used : FileLogSource(com.insightfullogic.honest_profiler.ports.sources.FileLogSource) LocalMachineSource(com.insightfullogic.honest_profiler.ports.sources.LocalMachineSource) AtomicReference(java.util.concurrent.atomic.AtomicReference) MachineListener(com.insightfullogic.honest_profiler.core.MachineListener) Profile(com.insightfullogic.honest_profiler.core.profiles.Profile) VirtualMachine(com.insightfullogic.honest_profiler.core.sources.VirtualMachine)

Example 3 with VirtualMachine

use of com.insightfullogic.honest_profiler.core.sources.VirtualMachine in project honest-profiler by jvm-profiling-tools.

the class LocalMachineSource method onNewDescriptor.

private void onNewDescriptor(VirtualMachineDescriptor descriptor) {
    VirtualMachine vm = attach(descriptor);
    if (vm != null) {
        vmMap.put(descriptor, vm);
        listener.onNewMachine(vm);
    }
}
Also used : VirtualMachine(com.insightfullogic.honest_profiler.core.sources.VirtualMachine)

Aggregations

VirtualMachine (com.insightfullogic.honest_profiler.core.sources.VirtualMachine)3 MachineListener (com.insightfullogic.honest_profiler.core.MachineListener)1 Profile (com.insightfullogic.honest_profiler.core.profiles.Profile)1 FileLogSource (com.insightfullogic.honest_profiler.ports.sources.FileLogSource)1 LocalMachineSource (com.insightfullogic.honest_profiler.ports.sources.LocalMachineSource)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1