Skip to content

Commit

Permalink
Added implementation of Android platform module.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Oct 7, 2015
1 parent 068fdcf commit f07cad6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion python/android/python/AndroidPlatform.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package python;

import android.os.Debug;


class AndroidPlatform implements python.PythonPlatform {
public AndroidPlatform() {}

public long clock() {
throw new org.python.exceptions.NotImplementedError("Android platform not implemented yet");
return Debug.threadCpuTimeNanos();
}

}
3 changes: 3 additions & 0 deletions python/common/python/PythonPlatform.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package python;

interface PythonPlatform {
/**
* Return the number of CPU nanoseconds that this thread has consumed.
*/
public long clock();

}
6 changes: 5 additions & 1 deletion python/oracle/python/OraclePlatform.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package python;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;


class OraclePlatform implements python.PythonPlatform {
public OraclePlatform() {}

public long clock() {
java.lang.management.ThreadMXBean tmxb = java.lang.management.ManagementFactory.getThreadMXBean();
ThreadMXBean tmxb = ManagementFactory.getThreadMXBean();
return tmxb.getCurrentThreadCpuTime();
}

Expand Down

0 comments on commit f07cad6

Please sign in to comment.