• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Starting a third-part app consumes 50% CPU!

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All,

I have a third-party application (VLC video decoder from http://www.videolan.org) that I start using Java, specifically using the following Java code:



I hold onto the process object so that I can close VLC later on.

When I start VLC using my Java application as shown above, the VLC application consumes 50% of the CPU before even doing anything; it's not even decoding video yet! (note: VLC the application is consuming 50% of the CPU, not my Java application; this per the Windows task manager). If I start VLC just by itself it doesn't consume anything more than 1% of the CPU.

Any reason why this would be so? It's causing a real problem when I actually start decoding video because VLC then consumes nearly 100% of the CPU.

Thanks,
Dave

Java 1.5+ on Windows XP
[ June 25, 2008: Message edited by: David Irwin ]
 
David Irwin
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Doing a little more research I came across the ProcessBuilder class in the Java 1.5 API. When I start VLC using the process builder the CPU usage is near 1% when idle. I'm hoping that this will help solve my problem.

Dave
 
David Irwin
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After looking at the Java 1.5 source it turns out that the Runtime.exec() method actually uses the ProcessBuilder class. And I have been unable to get my application to start successfully using the ProcessBuilder class alone.
Since Runtime.exec() actually uses ProcessBuilder internally I don't expect any fix if I were to get the standalone ProcessBuilder approach to work.

Any ideas?

Thanks,
Dave
 
Marshal
Posts: 72088
312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are familiar with the traps in Runtime.exed(), as described in the classic article by Daconta? Please do a search of JavaRanch; there are other threads active at present addressing similar questions.
[ June 27, 2008: Message edited by: Campbell Ritchie ]
 
David Irwin
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Campbell Ritchie:
You are familiar with the traps in Runtime.exed(), as described in the classic article by Daconta? Please do a search of JavaRanch; there are other threads active at present addressing similar questions.

[ June 27, 2008: Message edited by: Campbell Ritchie ]



Thanks for the reference...I hadn't read the article but for my sake I unfortunately was already doing much of what was suggested in the article.

Does anyone know of an alternative to using Runtime.exec(), such as some third-party library?

Thanks,
Dave
 
I will suppress my every urge. But not this shameless plug:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic