Tuesday Jan 19, 2010

Tips for porting Java applications to PS3 or any Blu-ray player

If you have a Java application that you want see working on Blu-ray Player, you will first need to create a Blu-ray Java disk image. There are samples for creating disk images on the hdcookbook .

The second most important thing is to make your application work against the Blu-ray Disk Java (BD-J) security sandbox model. This is not as simple as it sounds, for there are no easy means to debug Java applications on Blu-ray Players. But, we in the process of porting a huge Java application learnt some tricks that saved us enormous debugging effort. The same applications would have otherwise run successfully on a software player that is less restrictive than the real BD-J implementation. Ironically, it's easier to get a debug version of a software player.

When we were all set and expected our application to work on a hadrware Blu-ray player, and it failed to load, the failure invariably used to be due to some Security Exception. In order to trap the Security Exceptions, we ran the application on Standard Java SE (5 or 6), with the Security Manager enabled and granted permissions as appropriate.

We added the required workaround to the application so that the security restricted API calls were eliminated. For example, getting and setting a thread's context class loader is blocked on BD-J Platform. These calls were replaced with obtaining the current class's class loader instead. One by one we replaced all the security restricted calls and our application seamlessly ran on the Blu-ray player.

Sunday Aug 02, 2009

Profiling for the Blu-ray Java Platform

Challenges:

  • Profiling frameworks like JVMTI are not available for the Blu-ray Java platform.
  • Using System.out may not be feasible for some players are known to hinder the application performance when it's used.
  • The system clock on the players is too slow to measure anything meaningful on non-PS3 players.

Solution:

Our team at Sun have developed an innovative way of profiling of Blu-ray Java applications. I will refer to it as hdcookbook profiler as it's made available through our open source project at: https://hdcookbook.dev.java.net

More about hdcookbook profiler:

  • The execution time is measured using PC's clock, not the player's clock. This enables logging of nanoseconds instead of milliseconds.
  • The profiling data is collected with minimum heap data and time overhead.
  • The profiler does not generate any profiling information on its own. This is totally under user's control. The user explcitly adds the profiling points of interest to the application.
  • The profiling events (start/stop timer) are communicated to the PC by means of UDP packets. The profiling events can be debug messages as well.
  • For viewing the profiled data, we have two UI applications available, one of them was developed for immediate use and the second one came out later. A screen shot of the ProfileBrowser (second one) is shown here:



    Browser:

    • The vertical bars represent the execution times for each method. The RED stretches indicate the execution times that are out side the standard window of execution times for a given method. If you see many red colored stretches, you can increase the deviation factor say by: 2 ( i.e 2 \* standard deviation) or more to identify execution times that are taking way too longer than the standard execution times for that method.
    • You can select the time unit that is convenient for analyzing the data at hand. We have set Microseconds as a default time unit. You can switch between micro, nano, millis and secs without resulting in any loss of precision during switching.
    • The range slider (right side bar; looks like scroll bar but with arrows pointing in opposite directions) allows zoom-in and zoom-out (narrowing down) of the time scale with up and down mouse dragging. That means you could zoom into a time range of interest by just dragging the mouse.
    • Method Filtering: You can provide an expression to filter the data on the display (the editable box is on the left at the bottom) and get the timeline for selected method/s. For example, you could type in an expression: a | b This will only plot methods names starting with letters a or b. This is useful for focussing on the individual method/s of interest to see how the timeline looks for them.

    Also see this write up about profiler

Thursday May 29, 2008

Want to Build applications that run on PS3 or Blu-ray player in your living room?


Give it a shot!

It's now possible to create Java programs for Blu-ray players without a disc burner. You can go to BDLive.com hosted by Sun and RCDb and sign up for a free Blu-ray developer disk. This disk comes with a bootstrap application that enables you to run your own Blu-ray Java programs on the player.


During Java One 2008 it was announced that the developer disk you get from BDLive.com will provide a code for registering on BDlive.com.This will enable you to upload your Blu-ray Java programs on BDLive.com. The next step is to stick in the disk on your player which will automatically download your program from BDLive.com and run it on the player. This is made possible with the BD Live feature available on profile 2 Blu-ray players.


I'm waiting for my disk to be delivered to check out if it works as expected. I'm going to post more blogs on how to create fun and useful Blu-ray Java programs.











About

jaya_hangal

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today