Exemplo n.º 1
0
        // Redraw vertical gridlines for the exposed area.
        void DrawVerticalGrid(Gdk.Window win, Gdk.Rectangle rect)
        {
            SampleQueue data = debugManager.PowerData;

            if (data == null)
            {
                return;
            }

            int usPerPx = scale * data.Period;
            int t       = rect.X * usPerPx;

            // Find the first time divison before the exposed area
            t -= t % hSpacingUs;

            for (;;)
            {
                int x = t / usPerPx;

                if (x >= rect.X + rect.Width)
                {
                    break;
                }

                win.DrawLine(gcGrid, x, 0, x, allocation.Height - 1);
                t += hSpacingUs;
            }
        }
Exemplo n.º 2
0
        void updateSizing()
        {
            SampleQueue data = debugManager.PowerData;

            vertMax = 10;

            if (data != null)
            {
                drawer.SetSizeRequest(data.Count / scale, -1);

                // Calculate a scale for the vertical axis.
                while (vertMax < data.Max)
                {
                    vertMax *= 10;
                }

                // Calculate a good time-division spacing
                int usPerPx = scale * data.Period;

                hSpacingUs = 1;
                while (hSpacingUs / usPerPx < 20)
                {
                    hSpacingUs *= 10;
                }
            }

            drawer.QueueResize();
            updateStatus();
        }
Exemplo n.º 3
0
        public void ZoomFit()
        {
            SampleQueue data = debugManager.PowerData;

            if (data == null)
            {
                scale = 1;
            }
            else
            {
                scale = 1;
                while ((scale < maxScale) &&
                       (scrollAllocation.Width * scale) < data.Count)
                {
                    scale *= 2;
                }
            }

            updateSizing();
        }
Exemplo n.º 4
0
        // Redraw power samples for the exposed area.
        void DrawPower(Gdk.Window win, Gdk.Rectangle rect)
        {
            SampleQueue data = debugManager.PowerData;

            if (data == null)
            {
                return;
            }

            int[] slice = new int[rect.Width];
            int   len;

            len = data.Fetch(rect.X * scale, slice, scale);

            for (int i = 0; i < len; i++)
            {
                int x = rect.X + i;
                int h = slice[i] * allocation.Height / vertMax;

                win.DrawLine(gcBar, x, allocation.Height - 1 - h,
                             x, allocation.Height - 1);
            }
        }
Exemplo n.º 5
0
        // Process a shell message
        void HandleShell(Debugger.Message msg)
        {
            int spc = msg.Text.IndexOf(' ');

            if (spc < 0)
            {
                return;
            }

            string kind = msg.Text.Substring(0, spc);
            string arg  = msg.Text.Substring(spc + 1,
                                             msg.Text.Length - spc - 1);

            if (kind.Equals("power-sample-us"))
            {
                int period = XmlConvert.ToInt32(arg);

                powerData = new SampleQueue(period, 131072);
                if (PowerChanged != null)
                {
                    PowerChanged(this, null);
                }
            }
            else if (kind.Equals("power-samples"))
            {
                if (powerData != null)
                {
                    int[] samples = DecodeSamples(arg);

                    powerData.Push(samples);
                    if (PowerChanged != null)
                    {
                        PowerChanged(this, null);
                    }
                }
            }
        }
Exemplo n.º 6
0
        // Process a shell message
        void HandleShell(Debugger.Message msg)
        {
            int spc = msg.Text.IndexOf(' ');

            if (spc < 0)
            return;

            string kind = msg.Text.Substring(0, spc);
            string arg = msg.Text.Substring(spc + 1,
            msg.Text.Length - spc - 1);

            if (kind.Equals("power-sample-us"))
            {
            int period = XmlConvert.ToInt32(arg);

            powerData = new SampleQueue(period, 131072);
            if (PowerChanged != null)
            PowerChanged(this, null);
            }
            else if (kind.Equals("power-samples"))
            {
            if (powerData != null)
            {
            int[] samples = DecodeSamples(arg);

            powerData.Push(samples);
            if (PowerChanged != null)
            PowerChanged(this, null);
            }
            }
        }