Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8256217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:47:20+00:00 2026-06-08T01:47:20+00:00

Consider this producer-consumer code using a ArrayBlockingQueue : I want to find out a.

  • 0

Consider this producer-consumer code using a ArrayBlockingQueue : I want to find out
a. How much total time is consumed by put()/take() overall ?
b. how much total time is spent by the put() and take() calls in waiting ? Blocked ?

Taking a snapshot in VisualVM only shows upto a depth of run() , but not the put() / take() calls. Any idea how to get these times ?

In general , how do I get cumulative running times for all methods recursively down from the main() ?

final BlockingQueue<Integer> queue = new ArrayBlockingQueue<Integer>(QUEUE_SIZE);
    ExecutorService exec = Executors.newFixedThreadPool(2);
    exec.submit(new Runnable() {
        int i =0;
        @Override
        public void run() {
            while(i++<NUM)
                try {
                    queue.put(i);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

        }
    });

    exec.submit(new Runnable() {
        int i =0;
        @Override
        public void run() {
            while(i++<NUM)
                try {
                    queue.take();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            consumerFinished.countDown();
        }
    });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T01:47:22+00:00Added an answer on June 8, 2026 at 1:47 am

    You need to change the “CPU settings” that filter out all code belonging java.* packages. Check “Settings” on the “Sampler” tab and edit the “CPU settings” in a new preset. Presets are managed at the bottom of the CPU-settings tab.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this code: #include <iostream> template<class C> struct time { }; int main() {
Consider this code: enum { ERR_START, ERR_CANNOTOPENFILE, ERR_CANNOTCONNECT, ERR_CANNOTCONNECTWITH, ERR_CANNOTGETHOSTNAME, ERR_CANNOTSEND, }; char* ERR_MESSAGE[]
Consider this (rather pointless) javascript code: function make_closure() { var x = 123, y
Consider this code in a php file on my VPS server: <?php $url =
Consider this table: c_const code | nvalue -------------- 1 | 10000 2 | 20000
Consider this example code: a={}; a['herp']=['derp']; var b = jQuery.extend({}, a); b['herp'].push('foo'); alert(a['herp']); //this
Consider this example Javascript code: a = new Array(); a['a1']='foo'; a['a2']='bar'; b = new
Consider the following code: echo $this->Form->year('expiry',date('Y'),date('Y')+2) This produces output something like: 2013 2012 2011
Consider this code: public class ShortDivision { public static void main(String[] args) { short
Consider this contrived, trivial example: var foo = new byte[] {246, 127}; var bar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.