What is new command in Java8 from "jmap -heap <PID " - java-8

What is command in Java8 for jmap heap .I need to find Oldgen space of Memory for particular process.

if you want to create a heapdump with jmap, the command is:
jmap -dump:live,fle=/path/to/file/name.bin,format=b <pid>

From Java 8, We can use below command to get current stats of Heap Memory consumption for all the blocks.
jcmd PID PerfCounter.print
Which is basically the alternative to jmap -heap

Related

How much memory is used by GradleWrapperMain and GradleDaemon processes

How much memory is used by GradleWrapperMain and GradleDaemon processes. I see 2 such processes being started for each of my application started with (nohup ./gradlew bootRun). This would help understand how much memory gets consumed by each App, as we are planning to run multiple Apps
jps
3494 GradleWrapperMain
2552 GradleWrapperMain
3530 GradleDaemon
10460 Jps
2588 GradleDaemon
Command jps hints at a Linux platform or equivalent. There does not seem to be a gradle command to check memory.
Shell command top allows to watch memory use as other resources. The m flag might be the most relevant.
You can check the actual memory consume terminal on follow way:
programmname="firefox" # replace "firefox" by your programname
top | grep "$programmname"
The order of the value output is:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
Replace the "firefox" by the name of programm which you are interested in.
Output the data like memory consume, of the program which you are interested in on terminal:
# Replace the xed by your programname
xed & pid=$!
# echo the pid of your program
echo $pid
# Start top and output the data like memory use
top -p $pid

Monitoring RAM and CPU consumtion of Snakemake

I want to get CPU and RAM usage of a Snakemake pipeline across time.
I run my pipeline on a slurm managed cluster. I know that Snakemake
include benchmarking functions but they only reports pic consumption.
Ideally, I would like to have an output file looking like this :
t CPU RAM
1 103.00 32
2 ... ...
Is there any program to do so?
Thanks!
Don't know any program already doing this, but you can monitor the CPU and MEM usage via native unix commmands, this post gives an answer that could fit your requirements.
Here is a summary of the answer modified for this context:
You can use this bash function
logsnakemake() { while sleep 1; do ps -p $1 -o pcpu= -o pmem= ; done; }
You can tweak the frequency of logging by modifying the value of sleep.
To log your snakemake process with pid=123 just type in the terminal:
$ logsnakemake 123 | tee /tmp/pid.log
I've found Syrupy on github : a ps parser in python with a clear documentation.

Is there a way to limit time and memory resources for running a bash command?

Basically I want to run my compiled C++ code and limit execution time (to a second for example) and memory (to 100k) like the online judges. Is it possible by adding options to the command? This has to be done without modifying the source code of course.
Try ulimit command, it can set limits on CPU time and memory.
Try this example
bash -c 'ulimit -St 1 ; while true; do true; done;'
The result you will get will be
CPU time limit exceeded (core dumped)
To limit time you can use "timeout" command
timeout 15s command
Check this for more details: link

Ruby way to view memory usage?

Is there a Ruby way to view the memory usage of the running process? I have been using exec (or backticks) to call out to 'ps' but I'd rather do something that isn't system-specific. I'm starting to build docker containers and the handling of 'ps' seems to be inconsistent.
I'd much rather have a Ruby-specific method/class/etc. to get the current run-time memory of the Ruby process.
You can try with combination of rbtrace and ObjectSpace.
rbtrace -p PID -e 'Thread.new{require "objspace"; ObjectSpace.trace_object_allocations_start; GC.start(); ObjectSpace.dump_all(output: File.open("heap.json", "w"))}.join'
More info in the slides by Sam Saffron.

How can I collect performance data similar as pidstat using lttng?

By the performance data I mean like cpu, memory and disk usages for each process. I'm using Ubuntu 14.04 LTS, ans I installed the PPA version, but follow the instruction about how to use lttngTop I couldn't get it run: it always return error like "can't open trace file". Is there any other way to collect these data or could anyone tell me where I got wrong? Thanks.
Which commands did you use to setup your LTTng session? Did you enable the required event contexts? It's not immediately obvious, but lttngtop needs some event contexts that are not enabled by default. From the man page:
LTTngTop requires that the pid, procname, tid and ppid context
information are enabled during tracing.
This means you should issue a command like this before lttng start:
lttng add-context -k -t pid -t procname -t tid -t ppid

Resources