Single result of Virt-Top - bash

Is it possible to get one single result of the current stats from virt-top?
I´ve tried to use the --stream parameter but with that I get a new result every second.
I only need one result every execute of the command.
How can I reach that?

From the virt-top man page:
-b
Batch mode. In this mode keypresses are ignored.
-n iterations
Set the number of iterations to run. The default is to run continuously.
So I think what you want is:
virt-top -b -n 1
This is exactly the same as how you would achieve the same with normal "top".

Related

JMeter prints summary view on the command line for one script but not another

I have 2 JMeter scripts which I am running from the command line. In the first script, I can see the summary view on the console while the test is running. That is:
summary + 3234 in 00:00:30...
summary = 34872 in 00:31:30...
In the other script, none of the summary data is printed, although the script will run correctly and save the data to the output file.
I see the same behavior for these script whether I run them from a Windows command line or from Linux. What is the trick to enable the summary output for my second script?
I can think of 2 options:
Your "other" script runs less than 30 seconds and by default Summariser "ticks" every 30 seconds. If this is the case you can amend summariser.interval property so it would occur more frequently
You have Transaction Controllers everywhere in your "other" script and by default Summariser doesn't report the sample results originating from the Transaction Controllers. If this is the case - set summariser.ignore_transaction_controller_sample_result property to false
More information:
Configuring JMeter
Summariser - Generate Summary Results - configuration
Seeing similar behavior. The result summary is not printed when I use conf path parameter to run the script. Whereas it is shown when I remove the -p parameter
jmeter -n -t fullpathtojmx -p fullpathtopropertiesfile -l fullpathtojtlfile

Jmeter - Run test via command line - how to set Loop Count to Infinite

I'm running jmeter on jenkins starting the test via script such as:
jmeter -n -t ${WORKSPACE}/bin/test/${testscript}.jmx -l ./bin/test/result/${testscript}.jtl -Jhost=${host} -Jthreads=${env.THREADS} -Jiterations=${env.ITERATIONS} -Jrampup=${env.RAMPUP} -Jbuildnumber=${env.BUILD_NUMBER}"
I'd like to pass to the jmeter a parameter which turns the Loop Count to Infinite while starting the .jmx from command line above rather than hardcoding it into the jmx test itself. Reason why is that I want the test to be infinite: true only when it's "scheduled" in jenkins and not when triggered manually.
Does anyone know if the "Loop Count: Infinite" can be passed via script while starting a .jmx test?
Thanks in advance,
Vincenzo
As #AngshumanBasak state, -1 define infinite loop, so change your iterations/env.ITERATIONS command line parameter
-Jiterations=-1
Set
Loop Count = -1
in your jmeter script, to run infinitely. Hope, this resolves your issue.

get execution time only from the command gtime

I need to execute a command and get the execution time of it. I am using gtime but the output is a bit different from what I want.
gtime returns the result of the execution and then the execution time. I need to store the output of the command(which I need it to be the time only) in a variable and use it afterward.
Is there a way to change the command to get the execution time only?
So if I write the command below:
executiontime=$(gtime -f "%U" /Users/Desktop/SemanticLocality/optimathsat-1.6.2-macos-64-bit/bin/optimathsat < file.smt2)
echo "$executiontime"
then this is an example of the output I get:
sat
(objectives
(misses_80 1)
)
9.94
To get executable time only from the output you can modify your command on such way:
executiontime=$(gtime -f "%U" /Users/ouafaelachhab/Desktop/SemanticLocality/optimathsat-1.6.2-macos-64-bit/bin/optimathsat < file.smt2|tail -1)

How to use tee or > within "screen" while also supplying the name of the screen to them?

I am trying to start a number of jobs in different screens from a shell script. Each job will read in a different value of a parameter from a premade input file and run a simulation based on that value, then tee or > the output to a differently named file. So in a do loop around all the jobs, job 40 on screen "session40" will read in line 40 of the input file, run the simulation, and output to output40.dat, for example. (I am basically trying to run a few jobs in parallel in a very elementary way; it appears my computer has plenty of RAM for this).
I am encountering the issue that the > and | tee commands do not seem to work when I use "exec" to run a command on the remote screen, despite having attempted to start a bash shell there; when I use these commands, it just prints to standard output. Although these commands do work with the command "stuff," I do not know how to pass the job number to stuff, as it appears to only work with string inputs.
The current attempted script is as follows. I have replaced the simulation script with echo and > for a simpler example of the problem. Neither of the last two screen lines work.
for i in 1:10; do
screen -Sdm session$i bash
screen -S session$i -X exec echo $i > runnumber$i.output (method 1)
screen -S session$i -X stuff $'echo $i > runnumber$i.output\r' (method 2)
done
Might there be an easy fix?

How to make a program in a pipe not to be executed until the first data arrive without tempfile?

Specific case:
generate_data | curl -T - http://someserver/path
That means, I have a program that generate an output in the stdout, and I put that on a remote server with curl.
The problem is that if generate_data takes too much time, the server is going to return 408.
I know that pipes execute all the commands without waiting for data to be ready, so my next iteration was:
generate_data | ( sleep 20 ; curl -T - http://someserver/path )
The time was twice the max time needed to run generate_data, so all the things are ok. But... it is not a optimal solution.
I know I can create something more complex with read, and a proper shell script, but have the feeling that I an missing something obvious.
So... What can i use instead of the sleep 20; without creating a temp file?
generate_data > /tmp/generated_data; cat /tmp/generated_data | curl -T - http://someserver/path

Resources