IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaFX Discussion :

javafx : café corsé


Sujet :

JavaFX

  1. #1
    Membre du Club Avatar de r1-1024
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    138
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 138
    Points : 68
    Points
    68
    Par défaut javafx : café corsé
    Bonjour à tous,
    En suivant les tutos Sun javafx, j'ai lancé l'appli UIControls.fx (un petit Stage contenant divers contrôles).
    Tout fonctionne très bien sauf que le processeur est occupé à 70% puis très vite 100%. Cette petite scène d'une dizaine de boutons finit sa course à 250Mo

    On peut trouver le code directement chez Sun
    http://java.sun.com/javafx/1/tutoria.../UIControls.fx

    Voilà le code pour ceux qui préfèrent l'indentation du forum :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
     
    import javafx.scene.Scene;
    import javafx.scene.control.CheckBox;
    import javafx.scene.control.Label;
    import javafx.scene.control.ProgressBar;
    import javafx.scene.control.ProgressIndicator;
    import javafx.scene.control.RadioButton;
    import javafx.scene.control.Slider;
    import javafx.scene.control.TextBox;
    import javafx.scene.control.ToggleButton;
    import javafx.scene.control.ToggleGroup;
    import javafx.scene.layout.HBox;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    import javafx.animation.Timeline;
    import javafx.scene.control.Hyperlink;
     
     
    var opacityLevel: Number;
    Timeline {
       repeatCount: Timeline.INDEFINITE
       autoReverse: false
       keyFrames: [
         at (0s) {opacityLevel => 0.2},
         at (2s) {opacityLevel => 1.0}
         at (4s) {opacityLevel => 0.2}
       ]
    }.play();
     
    var group1 = ToggleGroup{};
    var group2 = ToggleGroup{};
     
    def slider = Slider {
       max: 100
    }
    Stage {
      title: "Controls (JavaFX sample)"
       scene: Scene {
       width: 510
       height: 400
       content:
          VBox {translateX: 10 translateY: 10 spacing: 20
                content: [
                      HBox {spacing: 5
                         content: [
                           Label {text: "RadioButton:"}
                           VBox{ content:[
                               RadioButton { toggleGroup: group2   text: "First"   
                                             selected: true
                               }
                               RadioButton { toggleGroup: group2   text: "Second" }
                            ]
                           }                    
                           Label {text: "TextBox:"}
                           TextBox {} 
                         ]
                       }
                      HBox {spacing: 5
                         content: [
                           Label {text: "ToggleButton:"}
                           ToggleButton { toggleGroup: group1 text: "Yes" selected: true }
                           ToggleButton { toggleGroup: group1  text: "No" }
                           ToggleButton { toggleGroup: group1   text: "I don't know" 
                                          opacity: bind opacityLevel
                           }
                         ]
                       }  
                      HBox {spacing: 5
                         content: [
                           Label {text: "CheckBox:"}
                           CheckBox { text: "Normal" }
                           CheckBox { text: "Checked"   selected: true }
                           CheckBox { allowTriState: true   text: "Undefined"   defined: false }
                         ]
                       }
                      HBox {spacing: 5
                         content: [
                           Label {text: "Slider:"}
                           slider,
                           Label {text: "Hyperlink:"}
                           Hyperlink { text: "javafx.com"}
                         ]
                       }
                      HBox {spacing: 5
                         content: [
                           Label {text: "ProgressBar:"}
                           VBox{
                               content: [
                                   HBox {
                                       content: [
                                           ProgressBar { progress: bind slider.value / slider.max }, 
                                           ProgressIndicator { progress: bind slider.value / slider.max }
                                       ]
                                   }          
                                   HBox {
                                       content: [
                                           ProgressBar { progress: -1 },
                                           ProgressIndicator { progress: -1 }
                                       ]
                                   }
                               ]
                           }
                        ]
                     }            
         ]//content of VBox
       }//VBox
     }//Scene
     
    }//Stage
    En modifiant le code, on s'aperçoit que ProgressBar et ProgressIndicator avec l'attribut progress à -1 provoquent le "OutOfMemory".

    La stack cache le outofmemory vraissemblable (caché derrière un NullPointerException):
    Unexpected exception caught in MasterTimer.timePulse():
    java.lang.NullPointerException
    at com.sun.scenario.effect.impl.sw.sse.SSEBoxShadowPeer.filter(SSEBoxShadowPeer.java:94)
    at com.sun.scenario.effect.impl.state.LinearConvolveKernel.filterImageDatas(LinearConvolveKernel.java:351)
    at com.sun.scenario.effect.BoxShadow.filterImageDatas(BoxShadow.java:393)
    at com.sun.scenario.effect.FilterEffect.filter(FilterEffect.java:94)
    at com.sun.scenario.effect.Offset.filter(Offset.java:158)
    at com.sun.scenario.effect.FilterEffect.filter(FilterEffect.java:86)
    at com.sun.scenario.effect.DelegateEffect.filter(DelegateEffect.java:65)
    at com.sun.scenario.effect.impl.j2d.J2DEffectHelper.render(J2DEffectHelper.java:79)
    at com.sun.scenario.scenegraph.EffectFilter.render(EffectFilter.java:25)
    at com.sun.scenario.scenegraph.SGNode.renderEffect(SGNode.java:1025)
    at com.sun.scenario.scenegraph.SGNode.doRender(SGNode.java:840)
    at com.sun.scenario.scenegraph.SGNode.render(SGNode.java:822)
    at com.sun.scenario.scenegraph.SGGroup.renderContent(SGGroup.java:325)
    at com.sun.scenario.scenegraph.SGNode.doRender(SGNode.java:845)
    at com.sun.scenario.scenegraph.SGNode.render(SGNode.java:800)
    at com.sun.scenario.scenegraph.SGGroup.renderContent(SGGroup.java:325)
    at com.sun.scenario.scenegraph.SGNode.doRender(SGNode.java:845)
    at com.sun.scenario.scenegraph.SGNode.render(SGNode.java:800)
    at com.sun.scenario.scenegraph.SGGroup.renderContent(SGGroup.java:325)
    at com.sun.scenario.scenegraph.SGNode.doRender(SGNode.java:845)
    at com.sun.scenario.scenegraph.SGNode.render(SGNode.java:800)
    at com.sun.scenario.scenegraph.SGGroup.renderContent(SGGroup.java:325)
    at com.sun.scenario.scenegraph.SGNode.doRender(SGNode.java:845)
    at com.sun.scenario.scenegraph.SGNode.render(SGNode.java:800)
    at com.sun.scenario.scenegraph.SGGroup.renderContent(SGGroup.java:325)
    at com.sun.scenario.scenegraph.SGNode.doRender(SGNode.java:845)
    at com.sun.scenario.scenegraph.SGNode.render(SGNode.java:822)
    at com.sun.scenario.scenegraph.SGGroup.renderContent(SGGroup.java:325)
    at com.sun.scenario.scenegraph.SGNode.doRender(SGNode.java:845)
    at com.sun.scenario.scenegraph.SGNode.render(SGNode.java:822)
    at com.sun.scenario.scenegraph.SGGroup.renderContent(SGGroup.java:325)
    at com.sun.scenario.scenegraph.SGNode.doRender(SGNode.java:845)
    at com.sun.scenario.scenegraph.SGNode.render(SGNode.java:822)
    at com.sun.scenario.scenegraph.SGGroup.renderContent(SGGroup.java:325)
    at com.sun.scenario.scenegraph.SGNode.doRender(SGNode.java:845)
    at com.sun.scenario.scenegraph.SGNode.render(SGNode.java:800)
    at com.sun.scenario.scenegraph.SGGroup.renderContent(SGGroup.java:325)
    at com.sun.scenario.scenegraph.SGNode.doRender(SGNode.java:845)
    at com.sun.scenario.scenegraph.SGNode.render(SGNode.java:800)
    at com.sun.scenario.scenegraph.JSGPanel.paintComponent(JSGPanel.java:245)
    at javax.swing.JComponent.paint(JComponent.java:1006)
    at javax.swing.JComponent.paintChildren(JComponent.java:843)
    at javax.swing.JComponent.paint(JComponent.java:1015)
    at javax.swing.JLayeredPane.paint(JLayeredPane.java:559)
    at javax.swing.JComponent.paintChildren(JComponent.java:843)
    at javax.swing.JComponent.paint(JComponent.java:1015)
    at com.sun.javafx.tk.swing.WindowImpl$2$1.paint(WindowImpl.java:152)
    at javax.swing.JComponent._paintImmediately(JComponent.java:4890)
    at javax.swing.JComponent.paintImmediately(JComponent.java:4676)
    at javax.swing.JComponent.paintImmediately(JComponent.java:4688)
    at com.sun.scenario.scenegraph.JSGPanel.repaintDirtyRegions(JSGPanel.java:334)
    at com.sun.scenario.scenegraph.JSGPanelRepainter.repaintAll(JSGPanelRepainter.java:122)
    at com.sun.scenario.scenegraph.JSGPanelRepainter$FrameDisplay.run(JSGPanelRepainter.java:134)
    at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:397)
    at com.sun.scenario.animation.AbstractMasterTimer$MainLoop.run(AbstractMasterTimer.java:274)
    at com.sun.embeddedswing.EmbeddedEventQueue.doPulse(EmbeddedEventQueue.java:562)
    at com.sun.embeddedswing.EmbeddedEventQueue.access$000(EmbeddedEventQueue.java:74)
    at com.sun.embeddedswing.EmbeddedEventQueue$2.run(EmbeddedEventQueue.java:465)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
    at com.sun.embeddedswing.EmbeddedEventQueue.dispatchEvent(EmbeddedEventQueue.java:440)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

  2. #2
    Membre régulier
    Profil pro
    Inscrit en
    Août 2009
    Messages
    64
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 64
    Points : 75
    Points
    75
    Par défaut
    Quel système, quelle version de JavaFX?
    Sur mon vieil ordinateur (dual core) tournant avec Windows XP Pro SP3, et JavaFX 1.2.1 (Java 1.6.0_16), cette application tourne à 40-45 % CPU (c'est déjà pas mal), la consommation mémoire est stable (autour de 35 Mo, c'est pas rien non plus) et je n'ai pas d'exception.

  3. #3
    Membre du Club Avatar de r1-1024
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    138
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 138
    Points : 68
    Points
    68
    Par défaut
    Bonjour,
    Voilà ma conf.

    Ordi :
    Macbook pro (Mac OS X 10.5.8 (9L31a))
    Intel Core 2 Duo
    2 Go RAM
    GeForce 8600M GT

    Sous eclipse :
    jre1.5 (sous éclipse changer en 1.6 fout pas mal de bordel)
    javafx 1.2.1_b28
    eclipse Galileo

    en ligne de cmd
    jre1.6.0_15

    j'vais essayer sous xp virtualisé.

    Il faut attendre 2/3 minutes avant que ça plante. Au début de la démo tout est impec sauf une utilisation excessive du cpu (ça ne se remarque pas sur la démo).

    Merci

  4. #4
    Membre du Club Avatar de r1-1024
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    138
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 138
    Points : 68
    Points
    68
    Par défaut
    Sous winxp (virtualbox) jre1.6.0_16 fx 1.2.1 pas de pb.
    Le Stage prend qq même 30Mo et 50%cpu, c pas mal pour une fenêtre de 10 boutons!

    Peut être que ça concerne que les jres < jre1.6.0_16 ou peut être que c un pb purement mac.

  5. #5
    Membre régulier
    Profil pro
    Inscrit en
    Août 2009
    Messages
    64
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 64
    Points : 75
    Points
    75
    Par défaut
    Je peux essayer avec une version 1.5 mais je soupçonne plutôt l'implementation Mac, l'exception se produit à bas niveau, le nom SSEBoxShadowPeer montre que la classe utilise SSE (les instructions avancées du Pentium).
    Le nombre de contrôles n'est pas en cause, je pense que le problème vient plutôt de l'animation d'une ombre.

  6. #6
    Membre du Club Avatar de r1-1024
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    138
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 138
    Points : 68
    Points
    68
    Par défaut
    Ce qui voudrait dire que le rendu est full CPU pas GPU. Avec jogl en arrière plan c'est dommage. Mais je pense pas que Sun décide de faire une accélération purement GPU, les intégrations et effets dans les navigateurs seraient moins riches.

    Si t'as une 1.5 winxp facilement accessible j'veux bien sinon j'le fais.

    Mais com.sun.scenario.effect.impl.sw.sse.SSEBoxShadowPeer.filter fait partie de fx. Donc ça provient surement de l'implémentation fx et pas jre.

    Essayer sur une jre win <1.6.0_16 nous renseignera.

  7. #7
    Membre du Club Avatar de r1-1024
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    138
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 138
    Points : 68
    Points
    68
    Par défaut
    jre1.5 est en EOL chez Sun.
    J'ai donc essayé winxp (virtualbox) jre1.6.0_15 fx 1.2.1 et pas de pb.

    Donc en fx 1.2.1 :
    winxp jre1.6.0_15 OK
    winxp jre1.6.0_16 OK
    mac jre1.6.0_15 KO
    mac jre1.5.0_20 KO

    C'est probablement la version fx mac qui merde.

  8. #8
    Membre régulier
    Profil pro
    Inscrit en
    Août 2009
    Messages
    64
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 64
    Points : 75
    Points
    75
    Par défaut
    Ce qui voudrait dire que le rendu est full CPU pas GPU. Avec jogl en arrière plan c'est dommage. Mais je pense pas que Sun décide de faire une accélération purement GPU, les intégrations et effets dans les navigateurs seraient moins riches.
    J'ai vu sur un blog une applet déterminant quel genre d'accélération graphique était utilisé. Avec mon vieux PC, je n'avais qu'un rendu CPU. L'auteur du blog m'a dit que c'était normal, les accélérations GPU ne sont disponibles qu'avec des cartes graphiques récentes, avec des shaders avancés...

  9. #9
    Membre du Club Avatar de r1-1024
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    138
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 138
    Points : 68
    Points
    68
    Par défaut
    Normalement c'est mon cas

    Mais pour mon pb, il faudrait qu'un autre utilisateur mac puisse le vérifier.
    Ca sera surement résolu dans prism.

Discussions similaires

  1. Programme coré et la bibliothèque <setjump.h>
    Par turbo_chess dans le forum C
    Réponses: 2
    Dernier message: 09/05/2007, 12h01
  2. Un PC au prix d'un café par jour : Le retour !!
    Par netah25 dans le forum Ordinateurs
    Réponses: 34
    Dernier message: 21/02/2006, 23h29

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo