-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added system fragment - added tracing demo project Signed-off-by: Mark Hoffmann <m.hoffmann@data-in-motion.biz>
- Loading branch information
Showing
16 changed files
with
411 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"> | ||
<attributes> | ||
<attribute name="module" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="aQute.bnd.classpath.container"/> | ||
<classpathentry kind="src" output="bin" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
10 changes: 10 additions & 0 deletions
10
org.gecko.playground.tracing.fragment/.settings/org.eclipse.jdt.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 | ||
org.eclipse.jdt.core.compiler.compliance=17 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning | ||
org.eclipse.jdt.core.compiler.release=enabled | ||
org.eclipse.jdt.core.compiler.source=17 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# aQute Tracing System Fragment | ||
|
||
[Github](https://github.com/aQute-os/biz.aQute.osgi.util/tree/master/biz.aQute.trace) | ||
[Maven](https://repo1.maven.org/maven2/biz/aQute/biz.aQute.trace.runpath/) | ||
|
||
This is a small tool that creates metrics for typical startup and teardown methods: | ||
|
||
* Activator#start | ||
* Activator#stop | ||
* Component#activate | ||
* Component#deactivate | ||
|
||
This is an example how to repackage it and making it a framework fragment | ||
|
||
## The Framework Fragment | ||
|
||
The *org.gecko.playground.tracing.fragment* be placed in the application. This is a Framework fragment. This means a fragment for the system bundle. | ||
Its activator should be called as well. So with this the tracer is started very early. | ||
|
||
It is important to know, that this fragment does not import foreign packages, except `org.osgi.framework`. It is also not allowed to export something. | ||
|
||
|
||
## Gogo Commands | ||
|
||
Further, to get some Gogo commands, the bundle *biz.aQute.trace.gui* can also be placed in the application (startlevel is unimportant here) you can then use the commands: | ||
|
||
* *tracer* - show table of the measurements in the console | ||
* *dump (html | json | text)* - create a currensponding dump in the console | ||
|
||
E.g. the HTML dump creates a HTML page with all results. | ||
|
||
The *bndrun* shows, how to start it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Fragment-Host: system.bundle | ||
Bundle-Activator: biz.aQute.trace.runpath.impl.Activator | ||
|
||
-buildpath: \ | ||
biz.aQute.trace.runpath,\ | ||
aQute.libg | ||
|
||
-conditionalpackage: \ | ||
javassist.*,\ | ||
biz.*,\ | ||
aQute.* | ||
|
||
Import-Package: \ | ||
sun.*;'resolution:'=optional,\ | ||
jdk.*;'resolution:'=optional,\ | ||
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
-runfw: org.eclipse.osgi;version=3.13 | ||
-runee: JavaSE-17 | ||
-runprovidedcapabilities: ${native_capability} | ||
|
||
-resolve.effective: active | ||
|
||
-runproperties: \ | ||
osgi.console.enable.builtin=false,\ | ||
osgi.console= | ||
|
||
-runpath=biz.aQute.trace.runpath | ||
|
||
-runrequires: \ | ||
bnd.identity;id='org.gecko.playground.tracing.fragment',\ | ||
bnd.identity;id='org.gecko.playground.tracing',\ | ||
bnd.identity;id='org.apache.felix.gogo.runtime',\ | ||
bnd.identity;id='org.apache.felix.gogo.command',\ | ||
bnd.identity;id='biz.aQute.trace.gui' | ||
|
||
#-runbundles+: \ | ||
# biz.aQute.trace.runpath;startlevel=1,\ | ||
# *;startlevel=4 | ||
-runbundles: \ | ||
aQute.libg;version='[6.4.0,6.4.1)',\ | ||
org.apache.felix.scr;version='[2.2.6,2.2.7)',\ | ||
org.osgi.service.component;version='[1.5.1,1.5.2)',\ | ||
org.osgi.util.function;version='[1.2.0,1.2.1)',\ | ||
org.osgi.util.promise;version='[1.3.0,1.3.1)',\ | ||
slf4j.api;version='[1.7.30,1.7.31)',\ | ||
slf4j.simple;version='[1.7.30,1.7.31)',\ | ||
biz.aQute.trace.gui;version='[1.9.0,1.9.1)',\ | ||
org.gecko.playground.tracing;version=snapshot,\ | ||
org.apache.felix.gogo.command;version='[1.1.2,1.1.3)',\ | ||
org.apache.felix.gogo.runtime;version='[1.1.6,1.1.7)',\ | ||
org.apache.felix.gogo.shell;version='[1.1.4,1.1.5)',\ | ||
org.apache.felix.inventory;version='[1.0.6,1.0.7)',\ | ||
org.gecko.playground.tracing.fragment;version=snapshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"> | ||
<attributes> | ||
<attribute name="module" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="aQute.bnd.classpath.container"/> | ||
<classpathentry kind="src" output="bin" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
3 changes: 3 additions & 0 deletions
3
org.gecko.playground.tracing/.settings/org.eclipse.core.resources.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
eclipse.preferences.version=1 | ||
encoding/<project>=UTF-8 | ||
encoding/bnd.bnd=UTF-8 |
10 changes: 10 additions & 0 deletions
10
org.gecko.playground.tracing/.settings/org.eclipse.jdt.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 | ||
org.eclipse.jdt.core.compiler.compliance=17 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning | ||
org.eclipse.jdt.core.compiler.release=enabled | ||
org.eclipse.jdt.core.compiler.source=17 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# aQute Tracing | ||
|
||
[Github](https://github.com/aQute-os/biz.aQute.osgi.util/tree/master/biz.aQute.trace) | ||
[Maven](https://repo1.maven.org/maven2/biz/aQute/biz.aQute.trace.runpath/) | ||
|
||
This is a small tool that creates metrics for typical startup and teardown methods: | ||
|
||
* Activator#start | ||
* Activator#stop | ||
* Component#activate | ||
* Component#deactivate | ||
|
||
## In bndtools | ||
|
||
Just follow the instruction on Github. | ||
|
||
## Non bnd-Environment | ||
|
||
In non-bnd environment there is the *org.gecko.playground.tracing.fragement*. It should be placed in the application. This is a Framework frageent, means a fragment for the system bundle. | ||
Its activator should be called as well. | ||
|
||
Refer to that project | ||
|
||
## Gogo Commands | ||
|
||
Further, to get some Gogo commands, the bundle *biz.aQute.trace.gui* can also be placed in the application (startlevel is unimportant here) you can then use the commands: | ||
|
||
* *tracer* - show table of the measurements in the console | ||
* *dump (html | json | text)* - create a currensponding dump in the console | ||
|
||
E.g. the HTML dump creates a HTML page with all results. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-buildpath: org.osgi.util.promise;version=latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-runfw: org.eclipse.osgi;version=3.13 | ||
-runee: JavaSE-17 | ||
-runprovidedcapabilities: ${native_capability} | ||
|
||
-resolve.effective: active | ||
|
||
-runproperties: \ | ||
osgi.console.enable.builtin=false,\ | ||
osgi.console= | ||
|
||
-runpath=biz.aQute.trace.runpath | ||
|
||
-runrequires: \ | ||
bnd.identity;id='org.gecko.playground.tracing',\ | ||
bnd.identity;id='org.apache.felix.gogo.runtime',\ | ||
bnd.identity;id='org.apache.felix.gogo.command',\ | ||
bnd.identity;id='biz.aQute.trace.runpath',\ | ||
bnd.identity;id='biz.aQute.trace.gui' | ||
|
||
#-runbundles+: \ | ||
# biz.aQute.trace.runpath;startlevel=1,\ | ||
# *;startlevel=4 | ||
-runbundles: \ | ||
aQute.libg;version='[6.4.0,6.4.1)',\ | ||
org.apache.felix.scr;version='[2.2.6,2.2.7)',\ | ||
org.osgi.service.component;version='[1.5.1,1.5.2)',\ | ||
org.osgi.util.function;version='[1.2.0,1.2.1)',\ | ||
org.osgi.util.promise;version='[1.3.0,1.3.1)',\ | ||
slf4j.api;version='[1.7.30,1.7.31)',\ | ||
slf4j.simple;version='[1.7.30,1.7.31)',\ | ||
biz.aQute.trace.gui;version='[1.9.0,1.9.1)',\ | ||
org.gecko.playground.tracing;version=snapshot,\ | ||
org.apache.felix.gogo.command;version='[1.1.2,1.1.3)',\ | ||
org.apache.felix.gogo.runtime;version='[1.1.6,1.1.7)',\ | ||
org.apache.felix.gogo.shell;version='[1.1.4,1.1.5)',\ | ||
org.apache.felix.inventory;version='[1.0.6,1.0.7)' |
52 changes: 52 additions & 0 deletions
52
org.gecko.playground.tracing/src/org/gecko/playground/tracing/LongActivationComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* Copyright (c) 2012 - 2023 Data In Motion and others. | ||
* All rights reserved. | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Data In Motion - initial API and implementation | ||
*/ | ||
package org.gecko.playground.tracing; | ||
|
||
import org.osgi.service.component.annotations.Activate; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Deactivate; | ||
|
||
/** | ||
* | ||
* @author mark | ||
* @since 05.09.2023 | ||
*/ | ||
@Component | ||
public class LongActivationComponent { | ||
|
||
@Activate | ||
public void activate() { | ||
try { | ||
System.out.println("Activate long ..."); | ||
Thread.sleep(750); | ||
System.out.println("Activated long"); | ||
} catch (InterruptedException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Deactivate | ||
public void deactivate() { | ||
try { | ||
System.out.println("De-activate long ..."); | ||
Thread.sleep(350); | ||
System.out.println("De-activated long"); | ||
} catch (InterruptedException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
...o.playground.tracing/src/org/gecko/playground/tracing/LongPromiseActivationComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* Copyright (c) 2012 - 2023 Data In Motion and others. | ||
* All rights reserved. | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Data In Motion - initial API and implementation | ||
*/ | ||
package org.gecko.playground.tracing; | ||
|
||
import java.util.concurrent.Executors; | ||
|
||
import org.osgi.service.component.annotations.Activate; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Deactivate; | ||
import org.osgi.util.promise.PromiseFactory; | ||
|
||
/** | ||
* | ||
* @author mark | ||
* @since 05.09.2023 | ||
*/ | ||
@Component | ||
public class LongPromiseActivationComponent { | ||
|
||
private final PromiseFactory pf = new PromiseFactory(Executors.newCachedThreadPool()); | ||
|
||
@Activate | ||
public void activate() { | ||
pf.submit(()->{ | ||
System.out.println("Activate long promise ..."); | ||
Thread.sleep(750); | ||
return null; | ||
}).onResolve(()->System.out.println("Activated long promise")); | ||
} | ||
|
||
@Deactivate | ||
public void deactivate() { | ||
pf.submit(()->{ | ||
System.out.println("De-activate long promise ..."); | ||
Thread.sleep(350); | ||
return null; | ||
}).onResolve(()->System.out.println("De-activated long promise")); | ||
} | ||
|
||
} |
52 changes: 52 additions & 0 deletions
52
...cko.playground.tracing/src/org/gecko/playground/tracing/NotSoLongActivationComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* Copyright (c) 2012 - 2023 Data In Motion and others. | ||
* All rights reserved. | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Data In Motion - initial API and implementation | ||
*/ | ||
package org.gecko.playground.tracing; | ||
|
||
import org.osgi.service.component.annotations.Activate; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Deactivate; | ||
|
||
/** | ||
* | ||
* @author mark | ||
* @since 05.09.2023 | ||
*/ | ||
@Component | ||
public class NotSoLongActivationComponent { | ||
|
||
@Activate | ||
public void activate() { | ||
try { | ||
System.out.println("Activate not so long ..."); | ||
Thread.sleep(150); | ||
System.out.println("Activated not so long"); | ||
} catch (InterruptedException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Deactivate | ||
public void deactivate() { | ||
try { | ||
System.out.println("De-activate not so long ..."); | ||
Thread.sleep(150); | ||
System.out.println("De-activated not so long"); | ||
} catch (InterruptedException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.