100% cpu load in vista

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
jamsoft
Newbie
Newbie
Posts: 11
Joined: Thu May 29, 2008 12:00 am

100% cpu load in vista

Post by jamsoft » Wed Oct 22, 2008 11:50 am

Hello,
if i put a simple tchart onto a form, then implement the code that i appended to this message, i get a 100% cpu load under windows vista
as soon as i move the mouse into the chart. In windows xp everything works fine, only moderate cpu load if i move the mouse
Am i doing something wrong? In Vista the tooltip flickers on and off it seems the chart is redrawn all the time.
Regards Klaus

Code: Select all

namespace TChartIssues
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
            tChart1.Aspect.View3D = false;


            Line line = new Line();
            line.Title = "Test data";
            line.Stacked = Steema.TeeChart.Styles.CustomStack.Overlap;

           tChart1.Series.Add(line);

            //add some random data:
            Random rand = new Random();
            for (int a = 0; a < 1000; a++)
            {
                line.Add(new DateTime(DateTime.Now.Ticks + (a * 9000000000)), rand.NextDouble());
            }
        }

        private Steema.TeeChart.Tools.CursorTool m_CursorTool;

        /// <summary>
        /// Get the cursortool
        /// </summary>
        protected Steema.TeeChart.Tools.CursorTool CursorTool
        {
            get
            {
                if (m_CursorTool == null)
                {
                    m_CursorTool = new Steema.TeeChart.Tools.CursorTool();
                    tChart1.Tools.Add(m_CursorTool);
                    m_CursorTool.FollowMouse = true;
                    m_CursorTool.Style = Steema.TeeChart.Tools.CursorToolStyles.Vertical;
                    m_CursorTool.ScopeStyle = Steema.TeeChart.Tools.ScopeCursorStyle.Empty;
                }
                return m_CursorTool;
            }
        }


        void tChart1_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                return;
            }
            if (tChart1.Series.Count == 0)
                return;

            Axes axes = tChart1.Axes;
            if (e.X < axes.Left.Position
              || e.X > axes.Bottom.IEndPos //.Right.Position 
              || e.Y < axes.Top.Position
              || e.Y > axes.Bottom.Position)
            {
                toolTip1.Active = false;
                return;
            }

            toolTip1.Active = true;

            StringBuilder toolTipString = new StringBuilder();

            bool origSnap = CursorTool.Snap;
            CursorTool.Snap = true;

            Series series = tChart1.Series[0];

            //fastcursor seems to be buggy, does not support 'snap'
            //CursorTool.FastCursor = false;

            series = tChart1.Series[0];
            CursorTool.Series = series;

            int dataIndex = CursorTool.SnapToPoint();
            if (dataIndex < 0)
                return;

            toolTipString.Append("Value below cursor on " + DateTime.FromOADate(series[dataIndex].X));
            toolTipString.Append(Environment.NewLine);

            toolTipString.Append(series[dataIndex].Y);
            CursorTool.Snap = origSnap;

            toolTip1.SetToolTip(this.tChart1, toolTipString.ToString());
        }
    }
}

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Oct 22, 2008 12:04 pm

Hi jamsoft,

I'm not able to reproduce this here in Vista and 2003 machines. In your code example ToolTip initialization is missing. Could you please send us a simple example project we can run "as-is" to reproduce the problem here?

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

jamsoft
Newbie
Newbie
Posts: 11
Joined: Thu May 29, 2008 12:00 am

Post by jamsoft » Thu Oct 23, 2008 8:29 am

I used the upload page to post the complete project,
was it reproducible and how could i fix the issue?
Kind Regards

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Oct 24, 2008 10:56 am

Hi jamsoft,

Thanks for the example project. We are not able to reproduce this here. We have tried it on three machines (2 with Vista and 1 with 2003, see specifications below). Which are your machine characteristics? All 3 machines are using VS2008 SP1 and .NET 3.5 SP1. Whversion of the .NET Framework and Visual Studio are you running?

Windows Vista machines:

OS Name: Microsoft® Windows VistaT Ultimate
OS Version: 6.0.6001 Service Pack 1 Build 6001
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Multiprocessor Free
Registered Owner: Christopher
Registered Organization:
Product ID: 89580-378-6673776-71926
Original Install Date: 06/03/2008, 09:28:20
System Boot Time: 24/10/2008, 08:22:39
System Manufacturer: PACKARD BELL BV
System Model: IMEDIA X1609
System Type: X86-based PC
Processor(s): 1 Processor(s) Installed.
[01]: x64 Family 6 Model 15 Stepping 7 GenuineIntel ~2400 Mhz
BIOS Version: Phoenix Technologies, LTD PBSFC2MB.P06, 20/07/2007
Windows Directory: C:\Windows
System Directory: C:\Windows\system32
Boot Device: \Device\HarddiskVolume2
System Locale: ca;Catalan
Input Locale: es;Spanish (Traditional Sort)
Time Zone: (GMT+01:00) Brussels, Copenhagen, Madrid, Paris
Total Physical Memory: 2.046 MB
Available Physical Memory: 841 MB
Page File: Max Size: 4.345 MB
Page File: Available: 2.362 MB
Page File: In Use: 1.983 MB
Page File Location(s): C:\pagefile.sys


Nombre de host: QUAD6600
Nombre del sistema operativo: Microsoft® Windows VistaT Home Premium
Versión del sistema operativo: 6.0.6001 Service Pack 1 Compilación 6001
Fabricante del sistema operativo: Microsoft Corporation
Configuración del sistema operativo: Estación de trabajo independiente
Tipo de compilación del sistema operativo: Multiprocessor Free
Propiedad de: David
Organización registrada:
Id. del producto: 89578-OEM-7332157-00102
Fecha de instalación original: 15/01/2008, 17:21:33
Tiempo de arranque del sistema: 21/10/2008, 5:26:01
Fabricante del sistema: MEDIONPC
Modelo el sistema: MS-7358
Tipo de sistema: X86-based PC
Procesador(es): 1 Procesadores instalados.
[01]: x64 Family 6 Model 15 Stepping 11 GenuineIntel ~2400 Mhz
Versión del BIOS: Phoenix Technologies, LTD 6.00 PG, 19/11/2007
Directorio de Windows: C:\Windows
Directorio de sistema: C:\Windows\system32
Dispositivo de arranque: \Device\HarddiskVolume1
Configuración regional del sistema: es;Español (internacional)
Idioma de entrada: es;Español (tradicional)
Zona horaria: (GMT+01:00) Bruselas, Copenhague, Madrid, París
Cantidad total de memoria física: 3.325 MB
Memoria física disponible: 1.614 MB
Archivo de paginación: tamaño máximo: 6.880 MB
Archivo de paginación: disponible: 5.458 MB
Archivo de paginación: en uso: 1.422 MB
Ubicación(es) de archivo de paginación: C:\pagefile.sys



Windows 2003 machine:

OS Name: Microsoft(R) Windows(R) Server 2003, Enterprise Edition
OS Version: 5.2.3790 Service Pack 2 Build 3790
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Server
OS Build Type: Multiprocessor Free
Registered Owner: Narcís Calvet
Registered Organization: Steema Software
Product ID: 69713-357-0168015-42568
Original Install Date: 22/01/2008, 13:11:56
System Up Time: 0 Days, 3 Hours, 39 Minutes, 44 Seconds
System Manufacturer: MEDIONPC
System Model: MS-7358
System Type: X86-based PC
Processor(s): 4 Processor(s) Installed.
[01]: x86 Family 6 Model 15 Stepping 11 GenuineIntel ~2392 Mhz
[02]: x86 Family 6 Model 15 Stepping 11 GenuineIntel ~2392 Mhz
[03]: x86 Family 6 Model 15 Stepping 11 GenuineIntel ~2392 Mhz
[04]: x86 Family 6 Model 15 Stepping 11 GenuineIntel ~2392 Mhz
BIOS Version: MEDION - 42302e31
Windows Directory: C:\WINDOWS
System Directory: C:\WINDOWS\system32
Boot Device: \Device\HarddiskVolume1
System Locale: ca;Catalan
Input Locale: es;Spanish (Traditional Sort)
Time Zone: (GMT+01:00) Brussels, Copenhagen, Madrid, Paris
Total Physical Memory: 4.094 MB
Available Physical Memory: 2.888 MB
Page File: Max Size: 5.973 MB
Page File: Available: 4.745 MB
Page File: In Use: 1.228 MB
Page File Location(s): C:\pagefile.sys


Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

jamsoft
Newbie
Newbie
Posts: 11
Joined: Thu May 29, 2008 12:00 am

Post by jamsoft » Thu Oct 30, 2008 10:25 am

I first thought that this was only caused due to the remote desktop i used
into the virtual testing machines, but even on a normal machine this error occurs.
It seems to have something todo with a loop in redrawing the chart just because the Tooltip is shown which hides the tooltip and then redraws it again.

Please advise for a workaround.
Kind Regards

The bug occurs on the following operating system

Betriebssystemname Microsoft® Windows Vista™ Ultimate
Version 6.0.6001 Service Pack 1 Build 6001
Zusätzliche Betriebssystembeschreibung Nicht verfügbar
Betriebssystemhersteller Microsoft Corporation
Systemname VISTATESTPC
Systemhersteller Dell Computer Corporation
Systemmodell Dimension 4550
Systemtyp X86-basierter PC
Prozessor Intel(R) Pentium(R) 4 CPU 2.53GHz, 2524 MHz, 1 Kern(e), 1 logische(r) Prozessor(en)
BIOS-Version/-Datum Dell Computer Corporation A05, 27.01.2003
SMBIOS-Version 2.3
Windows-Verzeichnis C:\Windows
Systemverzeichnis C:\Windows\system32
Startgerät \Device\HarddiskVolume1
Gebietsschema Deutschland
Hardwareabstraktionsebene Version = "6.0.6001.18000"
Benutzername INTRANET\Administrator
Zeitzone Mitteleuropäische Zeit
Installierter physikalischer Speicher (RAM) 1,00 GB
Gesamter realer Speicher 1,00 GB
Verfügbarer realer Speicher 462 MB
Gesamter virtueller Speicher 2,25 GB
Verfügbarer virtueller Speicher 1,64 GB
Größe der Auslagerungsdatei 1,29 GB
Auslagerungsdatei C:\pagefile.sys

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Oct 31, 2008 11:16 am

Hi jamsoft,

Thanks for the information. I have finally been able to reproduce the issue here in a single CPU machine. I have added it (TF02013507) to the defect list to be investigated for next releases.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Nov 10, 2008 2:06 pm

Hi jamsoft,

We have been investigating the issue further and we don't think this is a bug. The problem can be resolved with a couple of changes in your code. Here's the code that works ok:

Code: Select all

        private string newStr, oldStr;

        void tChart1_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                return;
            }
            if (tChart1.Series.Count == 0)
                return;

            Axes axes = tChart1.Axes;
            if (e.X < axes.Left.Position
              || e.X > axes.Bottom.IEndPos //.Right.Position
              || e.Y < axes.Top.Position
              || e.Y > axes.Bottom.Position)
            {
                toolTip1.Active = false;
                return;
            }

            toolTip1.Active = true;

            StringBuilder toolTipString = new StringBuilder();

            bool origSnap = CursorTool.Snap;
            CursorTool.Snap = true;

            Series series = tChart1.Series[0];

            //fastcursor seems to be buggy, does not support 'snap'
            //CursorTool.FastCursor = false;

            series = tChart1.Series[0];
            CursorTool.Series = series;

            int dataIndex = CursorTool.SnapToPoint();
            if (dataIndex < 0)
                return;

            toolTipString.Append("Value below cursor on " + DateTime.FromOADate(series[dataIndex].X));
            toolTipString.Append(Environment.NewLine);

            toolTipString.Append(series[dataIndex].Y);
            CursorTool.Snap = origSnap;
            newStr = toolTipString.ToString();

            if (newStr != oldStr)
            {
              toolTip1.SetToolTip(this.tChart1, newStr);
            }

            oldStr = newStr;
        }
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply