Monday, March 26, 2007

Pro's and Con's from the World Cup

Its good that India is out of super eights, for Indian Cricket, in general for cricket.
Pro's from the loss:
  • India has learnt it clearly does not deserve a place even in the top eight
  • Average, strike rate and whole bunch of runs and so called reputation is no longer a statistics to decide fate of the team.
  • Sponsors, ICC who, according to me give more importance to money than the game, would have learnt some lesson.
What according to me will be done by BCCI.
  • They would drop the coach( which sounds ok as his contract expires).
  • They may drop the captain( according to me is not a good decision).
  • Future prospects like Uthappa, Dhoni would be removed from the team, and old but reputational so called super starts will be retained.
  • Virendhar Shewag will be in the team, come on guys, he scored a great century against a great team, so Veeru back to form.
  • They would again hyphe the practice sesions saying the team will practice along with Indain Navy this time :-).
What would I do if I was the borad president( Konjam over than )
  • Drop all the batsmen except for Yuvraj(feilding),Uthappa( he is playing his first world cup, when people having 10k runs cannot deliver, why drop him? )
  • Bring back your fielding heros, Kaif, Raina and other youngsters who are brilliant in the feild.
  • Make bowlers who are more aggressive like Sreesanth to play every game.
  • Just send this team across one series and see how it works out.( anyways even if we send the normal team, they are going to lose :-) )
  • This will put pressure on senior players to perform, and their performance should be credited only if they do so outisde India.
  • For some reason, I would Retain Dravid, who is modest, good overseas and a gentlemen role model.
I don't mean to say the senior players would never get a chance to play, its just to create some pressure on them to perform.
Everything I spoke here is impossible, as this is India. If we had this much courage in decision making,we would have been playing super eights in the carribean right now...

Friday, March 23, 2007

Its only a game - too good article

Courtesy: Cricinfo

This piece was written before it was established that Bob Woolmer was murdered. We don't yet know for sure why or how Bob Woolmer died. We shouldn't rush to judgment; it is still possible that it was an accident. It is equally possible he was murdered. And, while conspiracy theorists are working overtime on the motives, it is also quite possible that we will never know the full truth.

And in the event of this not being an accident, it is quite likely that Woolmer was a victim of cricket's seamier side. Either it was the stress, induced by the most obscene and blind expectations of cricket fans who brook no failure, or he was killed by people who felt let down or had something to fear.

Either way, it should serve as a wake-up call to those who run cricket, and those who profess passion for it. If a game starts taking lives, there is something sickeningly wrong with it. But this is not really about Woolmer. We didn't need someone to die to awaken us to a problem. The signs have always been there, it's just that most of us have found it expedient to ignore them. Commodification has been chipping away at the soul of cricket for years, and now the game is the danger of losing its head.

Take the current predicament of this World Cup as an example. The major stake-holders in the tournament - the television channels and major sponsors - risk losing millions, either in cash or kind, if India go out in the first round. They are not the number one team in the world by a mile. Not even number two. They are ranked sixth in the ICC team ratings and, while that might not always be the best indicator of a team's worth, they have not won a competition of note outside the subcontinent since 1985. Yet the fate of the World Cup rides on them. It's a disaster waiting to happen.

Cricket has acquired a dangerous obsession with money, to the extent where it is not a question of a game needing the money to survive or grow but making as much as possible at any cost.


The reason for this is not hard to comprehend. Cricket has acquired a dangerous obsession with money, to the extent where it is not a question of a game needing the money to survive or grow but making as much as possible at any cost. Players have been ground to dust and cricket, the one-day variety in particular, has been divested of any meaning and consequence. It would seem that the administrators have learnt very little from the match-fixing scandal, which was as much a result of greed as of a surfeit of matches that meant little to the players.

Meanwhile, the Indian administrators have managed to market a massive captive television audience to acquire financial muscle that relies little on the capabilities of the national team. As a result the cricket economy has gone ahead of the game, which is struggling to catch up.

It's an economy that relies more on projection and hype than reality. SetMax, the entertainment channel owned by Sony, paid nearly 40 % of the total cost of the ICC rights in the hope of recouping it from advertisers. Luckily for them, India made it to the final of the last World Cup and one Champions Trophy. But that was clearly not enough and Sony didn't even bother to bid for the next set of rights, which have been won by ESPN-Star for US $1.1 billion.

ESPN-Star is a joint venture between Disney and NewsCorp, but there is little doubt which television audience they are banking on. It is an unhealthy dependence. So much should never depend on the performance of one team. Apart from putting unfair pressure on the players -- it must take a lot for the Indian players to play normally in such an abnormal situation -- it leaves the cricket economy dangerously imbalanced and prone to huge risks.

The passion of the fans is the biggest strength of cricket in the sub-continent - but it is also its weakness, particularly in case of India and Pakistan. Sri Lankan fans are far more stoic about their team's fortunes and far more accepting of failure, whereas in Bangladesh they are grateful for every little or big victory, be that of the team or individual. But in India and Pakistan, the passion borders on frenzy. As an Indian, I would like India to win the World Cup. But it might not be such a bad thing for cricket if they were to be knocked out in the first round


In India it is brazenly and cynically fueled by an increasingly sensationalist and populist mass media, which treats cricket as one of the biggest baits to attract advertisers. Instead of providing perspective and being the voice of reason, the media feeds the frenzy and cashes in on it. Stars are built up and decimated. Exaggerated glorification is matched by proportionate vilification. So cricketers are either to be worshipped or denigrated. There isn't a middle ground, a measure of reality, or a sense of proportion.

The reality is that India reaching the World Cup final would be an overachievement. Australia and South Africa possess superior teams, New Zealand have more balance and depth and Sri Lanka are the most improved team in world cricket. India have proven, but ageing, batsmen, a bowling attack that's susceptible to pressure and poor fielders. To be a fan is to dream. But to many Indian fans the dream is the reality.

Nationalism is the bedrock of cricket. But you can't call yourself a true fan if the sight of 18-year old Tamim Iqbal charging down pitch to belt Indian quick bowlers brought you no thrill. Yes, India played below themselves, but every cricket match has a winner. To be unable to comprehend, and appreciate, this runs against the spirit of the game.


Yes, India not making past the first round would be a huge setback. But it would be accorded the status of a national calamity. It will be discussed in Parliament. Television channels will conduct inquests. Effigies will be burnt, cricketers' homes will be attacked, and these will be gleefully publicised. A couple of months ago, Greg Chappell was slapped on the back by a man in Bhubaneswar seeking his fifteen seconds of fame. He was obliged. It could get worse. Someone could get killed. Perhaps someone has already been killed.

As an Indian, I would like India to win the World Cup. But it might not be such a bad thing for cricket if they were to be knocked out in the first round. Cricket needs a reality check. It has an unhealthy, and unsustainable, business model that relies primarily on an increasingly delusional and one-dimensional fan-base. The bubble has to burst for a semblance of sanity to be restored. We must learn to once again enjoy cricket as a game.

Thursday, March 22, 2007

Dynamic Tracing in sun Solaris - DTrace

A simple document I prepared for understading DTrace Probes...


What is DTrace?

DTrace is a comprehensive dynamic tracing facility that is built into Solaris and can be used by administrators and developers to examine the behavior of both user programs and of the operating system itself. With DTrace you can explore your system to understand how it works, track down performance problems across many layers of software, or locate the cause of aberrant behavior. It is safe to use on production systems and does not require restarting either the system or applications.

DTrace Overview

DTrace dynamically modifies the operating system kernel and user processes to record data at locations of interest, called probes. A probe is a location or activity to which DTrace can bind a request to perform a set of actions, like recording a stack trace, a timestamp, or the argument to a function. Probes are like programmable sensors scattered all over your Solaris system in interesting places. DTrace probes come from a set of kernel modules called providers, each of which performs a particular kind of instrumentation to create probes.

Project Objective

The major focus from the perspective of a project would be to
  • Provide a real-time FAQ answering questions as per request.
  • To solve common operational problems faced by Back Office.
  • To provide appropriate resons for aberrant behavior.
To sum up, the tool should act as a perfomance analysis tool helping Sun Solaris 10 users know where they are stuck and identify the internal details of their processes running.

Basic DTrace Functions

  • Examine the behavior of user programs and the Solaris OS and quickly identify the root causes of system and application bottlenecks.
  • Highlight trends and patterns to tune systems for best performance.
  • Track down performance problems across many layers of software.
  • Locate the cause of aberrant behavior.
  • Write reusable scripts for common or complex routines.

How to use DTrace?

DTrace includes a new scripting language called D which is designed specifically for dynamic tracing. With D it is easy to write scripts that dynamically turn on probes, collect the information, and process it. D scripts make it convenient for users to share their knowledge and troubleshooting methods with others

Introduction to D Scripts

Template

probe description
/predicate/ { actions }

Probe Description

provider:module:function:name

  • Provider: The name of the DTrace provider that is publishing this probe. The provider name typically corresponds to the name of the DTrace kernel module that performs the instrumentation to enable the probe.

  • Module: If this probe corresponds to a specific program location, the name of the module in which the probe is located. This name is either the name of a kernel module or the name of a user library.

  • Function: If this probe corresponds to a specific program location, the name of the program function in which the probe is located.

  • Name: The final component of the probe name is a name that gives you some idea of the probe's semantic meaning, such as BEGIN or END.

Predicate A predicate can be any D expression. Below are a few examples. The action is executed only when the predicate evaluates to true.

Actions The action section can contain a series of action commands separated by semi-colons (;)

Compilation and Instrumentation

  • How DTrace Command Executes? When you use the dtrace command you are invoking the compiler for the D language. Once your program is compiled, it is sent into the operating system kernel for execution by DTrace.There the probes that are named in your program are enabled and the corresponding provider performs whatever instrumentation is needed to activate them.
  • What about the Performance? All of the instrumentation in DTrace is completely dynamic: probes are enabled discretely only when you are using them.No instrumented code is present for inactive probes, so your system does not experience any kind of performance degradation when you are not using DTrace. Once your experiment is complete and the dtrace command exits, all of the probes you used are automatically disabled and their instrumentation is removed, returning your system to its exact original state. No effective difference exists between a system where DTrace is not active and one where the DTrace software is not installed.
  • Where does DTrace run and why should we prefer DTrace? The instrumentation for each probe is performed dynamically on the live running operating system or on user processes you select. The system is not paused in any way, and instrumentation code is added only for the probes that you enable. As a result, the probe effect of using DTrace is limited to exactly what you ask DTrace to do: no extraneous data is traced, no one big �tracing switch� is turned on in the system, and all of the DTrace instrumentation is designed to be as efficient as possible. These features enable you to use DTrace in production to solve real problems in real time.
  • Are D-scripts safe? DTrace D programs are compiled into a safe intermediate form that is used for execution when your probes fire. This intermediate form is validated for safety when your program is first examined by the DTrace kernel software. The DTrace execution environment also handles any run-time errors that might occur during your D program's execution, including dividing by zero, dereferencing invalid memory, and so on, and reports them to you. As a result, you can never construct an unsafe program that would cause DTrace to inadvertently damage the Solaris kernel or one of the processes running on your system.These safety features allow you to use DTrace in a production environment without worrying about crashing or corrupting your system. If you make a programming mistake, DTrace will report your error to you, disable your instrumentation, and you can correct your mistake and try again.

DTrace Limitations

  • Dtrace is not a good tool for post-mortem analysis. For example, one problem frequently encountered in Networking is the "where did my packet get queued up?"
  • dtrace will not be able to directly analyze the sequence of events that led to a memory leak or reference-count leak after the leak has occurred.

DTrace Code Snippets

The pid Provider

  • Here is the D script you can run to print all the functions that process id 1234 calls
/* The above line means that the script that follows needs to be
interpreted using dtrace. D uses C-style comments. */
pid1234:::entry
{}

You can run .d files using the command #dtrace -s file.d

  • The following example adds aggregates in the script you are developing to see a summary table of user functions
 pid1234:::entry
{
@count_table[probefunc]=count();
}

This script will collect information into a table and will continue to run until you press ^c (Control c). Once you stop the script, DTrace will print out the table of information. Notice that you do not need to write any code to print the table. DTrace automatically does this for you.

  • This script can easily be modified to collect a table with function and library name by changing the index to probemod, probefunc
 pid1234:::entry
{
@count_table[probemod,probefunc]=count();
}

  • Find how much time is being spent in each function. This can be done through the built in variable timestamp. You can create probes in the entry and return of the functions and calculate the time spent by the difference in timestamp from entry to return. The timestamp variable reports time in nanoseconds. Here is the modified script
pid1234:::entry
{
ts[probefunc] = timestamp;
}

pid$1:::return
{
@func_time[probefunc] = sum(timestamp - ts[probefunc]);
ts[probefunc] = 0;
}

Note that the ts[] is an array, and D has automatically declared and initialized it for you. It is good practice to save space by setting the variable to 0.
  • How to monitor a process from the time it starts until it ends. DTrace allows you to do this using the $target variable and the -c option. This script will count the number of times libc functions are called from a given application.
pid$target:libc::entry
{
@[probefunc]=count();
}

Save this script as libc_func.d and run it.

# libc_func.d -c "cat /etc/hosts"

You can easily replace "cat /etc/hosts" with the command of interest.

Sysinfo Provider

  • The following script counts the number of times various processes get to run in the CPU. Note that the sysinfo:::pswitch probe fires when a process is switched to run on the CPU. Remember to press ^c (Control c) after a few minutes.
sysinfo:::pswitch
{
@[execname] = count();
}

Syscall Provider

This is probably the most important provider to learn and use because system calls are the main communication channel between user level applications and the kernel. Knowing which system calls are being used among other information establishes metrics of system usage and identifies possible misbehavior. With the syscall provider you can easily identify who executes what and how much time a certain operation takes, helping you to identify the root cause of system misbehavior.

  • Script to find the stack trace when the program makes the write system call. Note that you need to run this with the -c option.
syscall::write:entry
{
@[ustack()]=count();
}
  • To list all the occurrences of the probe when it was fired and give information about the system calls at entry into the system that are performing a close system call, use the following script:

# dtrace -n syscall::close:entry

  • To start to identify the process which sent a kill signal to a particular process, use the following script

syscall::kill:entry
{
trace(pid);
trace(execname);
}
  • To determine how much time your webserver is spending at read, use the following script. This script can easily be modified for other processes
BEGIN
{
printf("size\ttime\n");
}
syscall::read:entry
/execname == "httpd"/
{
self->start = timestamp;
}
syscall::read:return
/self->start/
{
printf("%d\t%d\n", arg0, timestamp - self->start);
self->start = 0;
}

Proc Provider

This provider fires at processes and thread creation and termination as well as signals. It is a more sophisticated approach to the simple kill probe and will tell you which user sent a given signal (3head) to which process.
  • The following script prints out the process name, pid and uid when a new process is started in the system. Note that proc:::exec-success fires when a new process is started successfully.
proc:::exec-success
{
printf("%s(pid=%d) started by uid - %d\n",execname, pid, uid);
}
  • Trace all the signals sent to all the processes currently running on the system
proc:::signal-send
{
printf("%d was sent to %s by ", args[2], args[1]->pr_fname);
}
Note: We have to use dtrace -w for this example along with -s.
  • Add the conditional statement (/args[2] == SIGKILL/) into the script and send SIGKILL signals to different processes from different users.
proc:::signal-send
/args[2] == SIGKILL/
{
printf("SIGKILL was sent to %s by ", args[1]->pr_fname);
}

Sched Provider

This provider dynamically traces scheduling events. Use it to understand when and why threads sleep, run, change priority, or wake other threads.
  • The following script determines the amount of time the CPU spends on I/O wait and working. It also breaks the I/O process and indicates that the data that was retrieved during the I/O wait time by sendmail. This script can easily be modified to fit your particular situation.
sched:::on-cpu
/execname == "soffice.bin"/
{
self->on = vtimestamp;
}
sched:::off-cpu
/self->on/
{
@time[""] = sum(vtimestamp self->on);
self->on = 0;
}

I/O Provider

This provider looks into the disk input and output (I/O) subsystem. With the io provider you can get an in-depth understanding of iostat(1M) output.
  • Trace which files are being accessed on which device and to determine if the task being performed is a read or a write.
BEGIN
{
printf("%10s %58s %2s\n", "DEVICE", "FILE", "RW");
}
io:::start
{
printf("%10s %58s %2s\n", args[1]->dev_statname, args[2]->fi_pathname,
args[0]->b_flags & B_READ ? "R" : "W");
}

Wednesday, March 21, 2007

Sivaji - the BOSS

Today was one of the memorable days I was waiting for. thnaks to karthik for pinging me and giving me a link where I could find songs of Sivaji. Am a great Rajni, for just a simple reason that he is the ultimate entertainer and the gives me a chance to watch a movie in theatre with my family coz my parents would never come to theatre, except for Rajni movies. The recent lists of movies I went with my parents are : Chandramukhi, Padayappa( 2 times ), Arunachalam, Muthu. Wat else to say, my parents were ready to come for Rajni movie twice. Thats superstar for you. Thing is my parents are never interested in movies at all, thats wat surprises me.
The songs are good, the same AR Rehman flavor, which no one will like the first time.
One song, his usual style song is too good.
My duty as a fan to give you the lyrics.
Film : Sivaji
Music : A.R.Rahman
Song : Oru Koodai Sunlight

\"oru koodai sunlight..
oru koodai moonlight..
ondraaga saerndha colour dhanay en white..
appo dhaan pichai karrupay,ippo dhaan chekka sivapay..
eppodhum pachai thamizhan,ippo naan vellai thamizhan...

ada ada ada asithudhu un style
nada nada nada nadapadhu un style
gada gada gada siripadhu un style
pada pada pada pesuvadhu un style..

kalakudhu un style,izhukudhu un style,jeikudhu un sytleee..
kozhandhaiku un style,izhasukku un style,perusukku un styleeee..

ada ada ada asathudhu un style
nada nada nada nadapadhu un style
gada gada gada siripadhu un style
pada pada pada pesuvadhu un style
suda suda suda thoduvadhu un style
thada thada thada adhiradi un style
adikadi mudi kalaivadhu style
vara vara ellamay style....

ragalai seiyura thiru veera
mirala sei manmadha maara
kavi thedum kalaga kaara
kann thadavum kandhala maara
ginn nidru kanniya koora
thinn nindru vellai kaara...

adada nee kaithadi mittai
nadandhayae maraikira kattai,
irundhayae uruvathail ettai,
malarndhayae kozhu kozhu muthai,
ice nadhiyai nerambukul vittai,
g ennum sollilay suttai,
eiffel tower idhayathil nattai,
pattasai paatai,...

a o a o lets throw the fido
a o a o lets throw the fido
hero hero heraadhi hero
staro staro nee superstaro\"...

Sivaji - Indeed is a BOSS...
Nallavana aandvan sodhipaan, aana kei vida maatan...

Whooo haaa INDIA!!!

World Cup is up, and everyone are having their hearts in the mouth coz India, as usual, is into another do or die situation. And a personal feeling I have is, we never lost to a minnow. We lost to a side which is felding like they are having wings. And I feel, the difference between the two sides was the feilding. India was too casual in the feild, Dhoni missing a catch, which was not that difficult, off Munaf and Dravid missing a difficult chance, which the Bangladeshians would have surely taken.
Let India have the best batting line up in the world and a very experienced and clever bowling attack, they will never be champions until they grab the chances their bowlers ignite by feilding well.
I saw a television show in Jaya TV, in regard to cricket, when one of the selectors said that, when asked about Kaif's ommision from world cup, Vengsarkar said, we cannot take him into the team just for his fielding. And so they have taken Shewag and Pathan, who did excellently with bat/bowl, so ironic. Atleast Kaif was felding and gauranteed saving 20 runs/innings, even though he didnt bat well like shewag. The selection commitee, the board, the players have one concern that is more important than the game, and thats, personal interest.
ICC knows the loss it wil incur if India is out of the torunament soon. So they would surely try some bargaining. "Whoo haa India" - very sad India...
Jonty Rhodes once in an interview, said he used to bat at number 8 or 9, and the only job he did was feilding. Kaif was an exception. If kaif was in the squad and if he could save some runs and throws at stumps, your teams confidence is so high...
Indian cricket is more run by Politics, Money, Perosnal Interest and Greed, rather than talent.
But still, some where in my heart, I want INDIA to be there and win the Worlc Cup :-). this is the weakness Indians have, to be with your team even after knowing all this, wat to do, I am an Indian :-).