Sponsored Content
Full Discussion: thread count
Top Forums Shell Programming and Scripting thread count Post 302324237 by radoulov on Wednesday 10th of June 2009 09:37:09 AM
Old 06-10-2009
Try this:

Code:
#!/usr/bin/perl

use warnings;
use strict;

print "Hello, World...\n";

my $logFile = shift;
my ( $TIDCount, %TIDUnique );

die "usage: $0 <logFile>\n" unless defined $logFile;

die "Logfile $logFile doesn't exist\n" unless -f $logFile;

open my $log, $logFile or die "Can't open $logFile for reading\n";

print "Processing file $logFile...\n";

while (<$log>) {
    ++$TIDCount
      if / tid (\d+)/ && !$TIDUnique{$1}++;
}

print "Thread count for the logfile is $TIDCount\n";

 

4 More Discussions You Might Find Interesting

1. Programming

How to cancel a thread safely from the initial thread?

how about asynchronous canceling? or with signal? if with signal whether it effects the process? my english so badly :( :( (1 Reply)
Discussion started by: alan.zhao
1 Replies

2. Solaris

thread count using top

I am running a multithreaded program which creates 10 threads and works away. However, when I use top to monitor my program whilst it is running, it only shows 4 under the thread count! Can anyone explain if this is in fact the number of threads running in my process... (0 Replies)
Discussion started by: supahoop
0 Replies

3. UNIX for Dummies Questions & Answers

Thread count for a process id

Hi, I want to know a command/program to get thread count for a process id in unix box. Please help me in this regard. (1 Reply)
Discussion started by: manaac
1 Replies

4. Forum Support Area for Unregistered Users & Account Problems

Not able to post thread/reply to thread

Dear Moderator I am not able to post any new thread or post reply to mine old thread. Kindly help as i am stuck on one problem and needed suggestion. Regards Jaydeep (1 Reply)
Discussion started by: jaydeep_sadaria
1 Replies
All times are GMT -4. The time now is 07:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy