<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kishanth Prabakaran on Medium]]></title>
        <description><![CDATA[Stories by Kishanth Prabakaran on Medium]]></description>
        <link>https://medium.com/@kishanthprab?source=rss-6dd28e3a0ac5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*mBmgarmM_6-GqbwK.jpg</url>
            <title>Stories by Kishanth Prabakaran on Medium</title>
            <link>https://medium.com/@kishanthprab?source=rss-6dd28e3a0ac5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 00:29:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kishanthprab/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Java Stopwatch: Tool for Measuring ExecutionTime]]></title>
            <link>https://medium.com/@kishanthprab/java-stopwatch-tool-for-measuring-executiontime-f87524262a6b?source=rss-6dd28e3a0ac5------2</link>
            <guid isPermaLink="false">https://medium.com/p/f87524262a6b</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[software-performance]]></category>
            <category><![CDATA[time]]></category>
            <category><![CDATA[stopwatch]]></category>
            <category><![CDATA[performance-analysis]]></category>
            <dc:creator><![CDATA[Kishanth Prabakaran]]></dc:creator>
            <pubDate>Sun, 16 Apr 2023 18:25:23 GMT</pubDate>
            <atom:updated>2023-04-16T18:25:23.341Z</atom:updated>
            <content:encoded><![CDATA[<p>In software development, performance is an essential factor to consider. Measuring the performance of a program is crucial for determining its efficiency and identifying areas for improvement. One useful tool for measuring performance in Java is the Stopwatch class. you can also check the brief intro regarding the <a href="https://medium.com/@kishanthprab/performance-analysis-for-a-software-applciation-2499fed6b1cc">performance analysis in the Software article</a>.</p><p>So, in this article, we will explore the Stopwatch class and how it can be used to measure performance in Java programs.</p><p>What is the Stopwatch class in Java?</p><p>The Stopwatch class is a part of the Google Guava library and is used for measuring time intervals in Java programs. It provides a simple and accurate way to measure the time taken by a piece of code to execute.</p><p>The Stopwatch class provides few methods for measuring time:</p><p>createStarted() — creates (and starts) a new stopwatch<br>createUnstarted() — Creates (but does not start) a new stopwatch<br>elapsed(TimeUnit desiredUnit) — Returns the current elapsed time<br>isRunning() — Returns true if start() has been called on this stopwatch<br>reset() — Sets the elapsed time for this stopwatch to zero, and places it in a stopped state.<br>start() — Starts the stopwatch.<br>stop() — Stops the stopwatch.</p><p>These methods can be used to measure the time taken for a specific block of code to execute, or the time taken for an entire method or program to execute.</p><p>How to use the Stopwatch class?</p><p>Using the Stopwatch class in your Java program is simple. First, you need to add the Google Guava library to your project.</p><p>Once you have added the library to your project, you can create an instance of the Stopwatch class and use its createStarted() and elapsed() methods to measure the time your code takes. Here is an example of the simple logic to calculate time using Stopwatch:</p><pre>import com.google.common.base.Stopwatch;<br>import java.util.concurrent.TimeUnit;<br><br>public class StopwatchExample {<br>  public static void main(String[] args) {<br>  <br>    Stopwatch stopwatch = Stopwatch.createStarted();<br>    <br>    // your code segment 1<br>    System.out.println(&quot;Time taken for Segment1: &quot; + stopwatch.elapsed(TimeUnit.MILLISECONDS) +&quot; milliseconds&quot;);<br>    <br>    long markedTime = stopwatch.elapsed(TimeUnit.MILLISECONDS); <br>    // your code segment 2<br>    System.out.println(&quot;Time taken for Segment2: &quot; + (stopwatch.elapsed(TimeUnit.MILLISECONDS) - markedTime)+&quot; milliseconds&quot;);<br><br>    System.out.println(&quot;Total Time taken: &quot; + stopwatch.elapsed(TimeUnit.MILLISECONDS); + &quot; milliseconds&quot;);<br>  }<br>}<br><br></pre><p>In this example, we first create an instance of the Stopwatch class and start it using the createStarted() method. We then execute the code segment 1 and get the elapsed time. We then created a variable called “markedTime” to store the current time value before starting the Code segment 2. and then execute the code we want to measure and get the elapsed time from the Stopwatch elapsed() method and substract the markedTime value to get the exact time spent for segment 2. Finally, we calculate the total time using the elapsed() method and print the result.</p><p>In conclusion, the Stopwatch class is a useful tool for measuring performance in Java programs.</p><p>You can also check the Google Java library for more information: <a href="https://guava.dev/releases/18.0/api/docs/">https://guava.dev/releases/18.0/api/docs/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f87524262a6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Performance Analysis for a Software Application]]></title>
            <link>https://medium.com/@kishanthprab/performance-analysis-for-a-software-applciation-2499fed6b1cc?source=rss-6dd28e3a0ac5------2</link>
            <guid isPermaLink="false">https://medium.com/p/2499fed6b1cc</guid>
            <category><![CDATA[performance-analysis]]></category>
            <category><![CDATA[software-performance]]></category>
            <category><![CDATA[time-measurement]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[performance]]></category>
            <dc:creator><![CDATA[Kishanth Prabakaran]]></dc:creator>
            <pubDate>Sun, 16 Apr 2023 17:43:20 GMT</pubDate>
            <atom:updated>2023-04-16T18:27:54.154Z</atom:updated>
            <content:encoded><![CDATA[<p>When analyzing the performance of code, there are several key things to consider. Here are a few important ones:</p><ol><li>Execution Time: One of the most important things to consider is how long the code takes to execute. This can be measured using a tool like a <strong>Stopwatch</strong> or a profiler. It’s important to measure the time it takes to execute specific parts of the code and the entire program to identify any performance bottlenecks.<br><a href="https://medium.com/@kishanthprab/java-stopwatch-tool-for-measuring-executiontime-f87524262a6b">you can check the article about Stopwatch to get more idea</a></li><li>Memory Usage: Another important factor to consider is how much memory the code uses. Large amounts of memory usage can slow down the program and cause it to crash or perform poorly. You can monitor memory usage using a tool like a profiler or by analyzing memory dumps.</li><li>CPU Usage: The amount of CPU usage is also an important factor to consider. High CPU usage can cause the program to slow down or even crash. You can monitor CPU usage using a tool like a profiler or the Task Manager in Windows.</li><li>Algorithm Efficiency: The efficiency of the algorithms used in the code can also impact performance. Some algorithms are more efficient than others, and choosing the right one can make a significant difference in performance. Analyzing the performance of different algorithms can help you choose the most efficient one.</li><li>I/O Operations: Input/output (I/O) operations can also impact performance. Reading from and writing to disks or networks can be slow, so minimizing the number of I/O operations and optimizing them can improve performance.</li></ol><p>Overall, analyzing the performance of code requires a holistic approach that takes into account several factors, including execution time, memory usage, CPU usage, algorithm efficiency, and I/O operations. By carefully analyzing these factors, developers can identify performance bottlenecks and optimize their code for better performance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2499fed6b1cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>