10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
HI
I need to get the function "kick" to get executed in any way the parameters are passed in to the function. The parameters are first stored in a dictionary
self.otherlist = {}
print self.otherlist
self.populateTestList(self.system_type)
print... (1 Reply)
Discussion started by: Priya Amaresh
1 Replies
2. Shell Programming and Scripting
Hi,
I want to be able to sort/print a hash based on the string length of the values.
For example
%hash = (
key1 => 'jeri',
key2 => 'corona',
key3 => 'una,
);
I want to be able to print in the following order (smallest to largest)
una,jeri,corona
OR... (1 Reply)
Discussion started by: jdilts
1 Replies
3. Shell Programming and Scripting
I want to sort values of a hash in ascending order.
my %records;
for my $value (sort values %records){print $value,"\n";}
When I use the above code I get values in this order: 1,10,11,2,3,4,5,6,7,8,9. But, I need values in my output in this order: 1,2,3,4,5,6,7,8,9,10,11.
Can Someone... (1 Reply)
Discussion started by: koneru_18
1 Replies
4. Shell Programming and Scripting
Hi All,
Thanks all for the continued support so far.
Today, I need to find the most occurring string/number(also called mode in statistics terminology) for each column in a data file (.csv type).
For one column of data(1.txt) like below
Sample
1
2
2
3
4
1
1
1
2
I can find the mode... (6 Replies)
Discussion started by: ks_reddy
6 Replies
5. Shell Programming and Scripting
Dear Forum
I'm Trying to use split function to split a string, but the output is not as the same order as of the string, please see simple example
echo " " | nawk -v var="First;Second;Third;Fourth" '
BEGIN {split(var, arr,";") for(i in arr){print arr }}'
The output is
Second
Third... (6 Replies)
Discussion started by: yahyaaa
6 Replies
6. Shell Programming and Scripting
Can Someone explain me why even using Tie::IxHash I can not get the output data in the same order that it was inserted? See code below.
#!/usr/bin/perl
use warnings;
use Tie::IxHash;
use strict;
tie (my %programs, "Tie::IxHash");
while (my $line = <DATA>) {
chomp $line;
my(... (1 Reply)
Discussion started by: jgfcoimbra
1 Replies
7. Programming
Hi,
I want build 10 processus with fork and that each processus write a value betwen 0 and 9 , but each processus send the same value .
So my code ,you can compile and try .
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/ipc.h> ... (7 Replies)
Discussion started by: carton99
7 Replies
8. Programming
I have created my own hash table class, but am looking to speed it up. My current hash function is:
int HashTable::hashFunc(const string &key) const
{
int tableSize = theLists.size();
int hashVal = 0;
for(int i = 0; i<key.length(); i++)
hashVal =... (7 Replies)
Discussion started by: killerqb
7 Replies
9. Shell Programming and Scripting
I have a file with a format of
A,2
B,2
G,3
A,2
A,3
A,2
D,7
A,2
E,2
A,2
I need to create a sum of each alphabet with the numbers assigned to it using awk. (2 Replies)
Discussion started by: dinjo_jo
2 Replies
10. Programming
Hi all,
Is the rand() function in C uniform or normal distribution. If it is unform, is there a random function that is normal.
Thanks and Regards (2 Replies)
Discussion started by: omran
2 Replies
Sys::Statistics::Linux::ProcStats(3pm) User Contributed Perl Documentation Sys::Statistics::Linux::ProcStats(3pm)
NAME
Sys::Statistics::Linux::ProcStats - Collect linux process statistics.
SYNOPSIS
use Sys::Statistics::Linux::ProcStats;
my $lxs = Sys::Statistics::Linux::ProcStats->new;
$lxs->init;
sleep 1;
my $stat = $lxs->get;
Or
my $lxs = Sys::Statistics::Linux::ProcStats->new(initfile => $file);
$lxs->init;
my $stat = $lxs->get;
DESCRIPTION
Sys::Statistics::Linux::ProcStats gathers process statistics from the virtual /proc filesystem (procfs).
For more information read the documentation of the front-end module Sys::Statistics::Linux.
IMPORTANT
I renamed key "procs_blocked" to "blocked"!
LOAD AVERAGE STATISTICS
Generated by /proc/stat and /proc/loadavg.
new - Number of new processes that were produced per second.
runqueue - The number of currently executing kernel scheduling entities (processes, threads).
count - The number of kernel scheduling entities that currently exist on the system (processes, threads).
blocked - Number of processes blocked waiting for I/O to complete (Linux 2.5.45 onwards).
running - Number of processes in runnable state (Linux 2.5.45 onwards).
METHODS
new()
Call "new()" to create a new object.
my $lxs = Sys::Statistics::Linux::ProcStats->new;
Maybe you want to store/load the initial statistics to/from a file:
my $lxs = Sys::Statistics::Linux::ProcStats->new(initfile => '/tmp/procstats.yml');
If you set "initfile" it's not necessary to call sleep before "get()".
It's also possible to set the path to the proc filesystem.
Sys::Statistics::Linux::ProcStats->new(
files => {
# This is the default
path => '/proc',
loadavg => 'loadavg',
stat => 'stat',
}
);
init()
Call "init()" to initialize the statistics.
$lxs->init;
get()
Call "get()" to get the statistics. "get()" returns the statistics as a hash reference.
my $stat = $lxs->get;
raw()
Get raw values.
EXPORTS
No exports.
SEE ALSO
proc(5)
REPORTING BUGS
Please report all bugs to <jschulz.cpan(at)bloonix.de>.
AUTHOR
Jonny Schulz <jschulz.cpan(at)bloonix.de>.
COPYRIGHT
Copyright (c) 2006, 2007 by Jonny Schulz. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-03-09 Sys::Statistics::Linux::ProcStats(3pm)