Commit Graph

5555 Commits

Author SHA1 Message Date
Andreas Kling
e4267020c4 ProfileViewer: Show kernel frames with a red icon :^) 2019-12-14 16:16:53 +01:00
Andreas Kling
f692577559 Kernel: Disable interrupts while modifying the PIC IMR 2019-12-14 16:16:37 +01:00
Andreas Kling
8de5a0be41 TCP: Log packet metadata when receiving a TCP packet with no socket 2019-12-14 13:03:26 +01:00
Andreas Kling
9d67a6ba34 E1000: Disable interrupts while getting ready to wait on TX completion 2019-12-14 13:02:40 +01:00
Andreas Kling
7d0583a33f Kernel: Ignore IRQ 15 for now
Sometimes QEMU hits us with an IRQ 15 and I don't know what it is.
Just ignore it for now instead of crashing the system.
2019-12-14 12:21:39 +01:00
Andreas Kling
8b2280c374 Kernel: Allow buffering up to 128 KB in an IPv4Socket before refusing 2019-12-14 12:17:37 +01:00
Andreas Kling
d723d9844f Kernel: Remove spammy log message in sys$sendto() 2019-12-14 11:30:45 +01:00
Andreas Kling
6b71250d1a LibCore: Silence some aggressive CSocket and CHttpJob debug spam 2019-12-14 11:30:18 +01:00
Andreas Kling
ac215ca601 Net: Try to reuse incoming packet buffers to avoid allocation churn
The majority of the time in NetworkTask was being spent in allocating
and deallocating KBuffers for each incoming packet.

We'll now keep up to 100 buffers around and reuse them for new packets
if the next incoming packet fits in an old buffer. This is pretty
naively implemented but definitely cuts down on time spent here.
2019-12-14 11:07:37 +01:00
Andreas Kling
39246fb621 E1000: Use a WaitQueue to sleep while waiting for a transmit IRQ 2019-12-14 10:47:17 +01:00
Andreas Kling
bcffe31d3a LibCore: Bump the CHttpJob receive buffer size from 4KB to 64KB
4KB gets pretty mmap/munmap heavy when downloading larger files,
so bump this a bit to reduce time spent in memory allocation.

This can be improved in various ways, but I'm not sure what the
best way forward is at the moment.
2019-12-14 10:01:20 +01:00
Andreas Kling
77cb5594b0 IPv4: Only buffer payload bytes for SOCK_STREAM sockets
Since stream sockets don't actually need to deliver packets-at-a-time
data in recvfrom(), they can just buffer the payload bytes instead.
This avoids keeping one KBuffer per incoming packet in the receive
queue, which was a big performance issue in ProtocolServer.

This code is definitely not perfect and is something we should keep
improving over time.
2019-12-14 09:43:31 +01:00
Andreas Kling
4d406d5c6d LibGUI: GAbstractColumnModel should never claim to hit a toggle box
Only GTreeView can hit a toggle box in index_at_event_position().
2019-12-14 00:21:51 +01:00
Andreas Kling
561718d88b LibGUI: Improve GTreeView column auto-sizing
Rerun the column auto-sizing algorithm when opening/closing nodes.
Also use the column name as the minimum column width for the tree
column as well.
2019-12-13 23:51:16 +01:00
Andreas Kling
5cd4fb4db2 ProfileViewer: Use the new multi-column tree model support in GTreeView
Put the sample count into a separate column. This is so neat :^)
2019-12-13 23:42:29 +01:00
Andreas Kling
0ac74d3778 LibGUI: Make GTreeView inherit from GAbstractColumnView
This makes GTreeView able to support multi-column models!

Only one column can be the "tree column", this is column 0 by default
but can be changed by overriding GModel::tree_column().
2019-12-13 23:36:36 +01:00
Andreas Kling
b909d991f1 LibDraw: Add a way to check for horizontal/vertical Rect intersections 2019-12-13 23:36:17 +01:00
Andreas Kling
2d39bce3f6 LibGUI: Add a GAbstractColumnView base class for GTableView
Almost everything in GTableView moves up to GAbstractColumnView.
This is in preparation for sharing a base class between GTableView
and GTreeView :^)
2019-12-13 20:54:40 +01:00
William McPherson
69d05fbf44 Piano: Add triangle wave and noise
The squad is complete :^)

You can find the equation for the triangle wave here:
https://en.wikipedia.org/wiki/Triangle_wave
We're using this one:
|x mod 4 - 2| - 1
Modifications have been made to correct the frequency and phase:
|(4x + 1) mod 4 - 2| - 1

The white noise is generated by calling rand() and dividing it by
RAND_MAX to get a value from 0 to 1. Then it's adjusted to fit between
-1 and 1.
2019-12-13 19:30:14 +01:00
Tommy Nguyen
091c783626 FileManager: Check which widget has focus for context menu actions
This fixes the issue where application shortcuts only operated on the
TreeView.
2019-12-12 23:53:12 +01:00
Andreas Kling
9150be4716 ProfileViewer: Make sure ProfileNodes have the correct parent pointer
We were forgetting to call ProfileNode::add_child() which is how the
parent node pointer gets set. This fixes the weird looking GTreeView.
2019-12-12 22:51:08 +01:00
Tommy Nguyen
d8b7cd940f TreeView: Clear metadata after model update
When the filesystem model is updated, it is rebuilt. This means dangling
indexes inside the TreeView metadata table will have old information and random
directories will toggle open. Clearing the table alleviates this issue.
2019-12-12 22:41:28 +01:00
Tommy Nguyen
2bd640277e LibGUI: Add missing call to did_update() when updating GFileSystemModel 2019-12-12 22:41:28 +01:00
Andreas Kling
19d8c675f1 ProfileViewer: Begin work on a visualization tool for profiles :^)
We begin with a simple treeview that shows a recorded profile.
To record and view a profile of a process with <PID>, simply do this:

$ profile <PID> on
... wait while PID does something interesting ...
$ profile <PID> off
$ cat /proc/profile > my-profile.prof
$ ProfileViewer my-profile.prof
2019-12-12 22:01:06 +01:00
Andreas Kling
0f393148da Kernel: Separate out the symbol offsets in profile output
Instead of saying "main +39" and "main +57" etc, we now have a separate
field in /proc/profile for the offset-into-the-symbol.
2019-12-12 21:59:47 +01:00
Andreas Kling
078ee798f7 Kernel: Bump KBufferBuilder VM allocation to 4 MB
This is pretty large but since it's not eagerly committed to physical
pages, it's probably okay. I'm bumping this after running out of space
for a ProtocolServer profile run :^)
2019-12-12 21:58:32 +01:00
Andreas Kling
fe874bc455 JsonValue: Fix wrong return type of as_u32() and friends 2019-12-12 21:17:26 +01:00
Andreas Kling
bc919c8432 ProcFS: Rename "samples" in /proc/profile to "frames"
These are stack frames, not profile samples. :^)
2019-12-12 20:36:41 +01:00
Tommy Nguyen
17f3948b15 FileManager: Add a context menu to the TreeView
This adds a context menu to the TreeView with the ability to copy/paste, create
new directories, etc. This does not address the issue mentioned above where
using the global application shortcut does not apply to whatever view has
focus.
2019-12-12 11:19:02 +01:00
Tommy Nguyen
f26548395e LibGUI: Add context_menu_event to GTreeView 2019-12-12 11:19:02 +01:00
Andreas Kling
b32e961a84 Kernel: Implement a simple process time profiler
The kernel now supports basic profiling of all the threads in a process
by calling profiling_enable(pid_t). You finish the profiling by calling
profiling_disable(pid_t).

This all works by recording thread stacks when the timer interrupt
fires and the current thread is in a process being profiled.
Note that symbolication is deferred until profiling_disable() to avoid
adding more noise than necessary to the profile.

A simple "/bin/profile" command is included here that can be used to
start/stop profiling like so:

    $ profile 10 on
    ... wait ...
    $ profile 10 off

After a profile has been recorded, it can be fetched in /proc/profile

There are various limits (or "bugs") on this mechanism at the moment:

- Only one process can be profiled at a time.
- We allocate 8MB for the samples, if you use more space, things will
  not work, and probably break a bit.
- Things will probably fall apart if the profiled process dies during
  profiling, or while extracing /proc/profile
2019-12-11 20:36:56 +01:00
Andreas Kling
adb1870628 LibHTML: Rename HTMLImageElement::m_image_data => m_encoded_data 2019-12-11 18:30:42 +01:00
William McPherson
61f2704d58 Shell: Tab completion for paths
If the cursor is in front of a token that is not the first token, we try
to split it on the last slash. If there is a slash, the first part is
the directory to search and the second part is the token to complete.
If there is no slash, we search the current directory and use the entire
token for completion.
If we find a single match and it's a directory, we add a slash. If it's
a normal file, we add a space, unless there already is one.

Also renamed cut_mismatching_chars() parameters to be more appropriate.
2019-12-11 12:10:52 +01:00
William McPherson
4ae8d929b4 Shell: Improve tab completion behaviour
A space is added if only one match is found, but we avoid adding
redundant spaces.

We complete "empty" tokens, i.e. when the cursor is at the start of the
line or in front of a space. For example:
    mkdir test
    cd test
    touch test
    chmod +x test
    export PATH=/home/anon/test
Now if you press tab, or space and then tab, you will get "test". Notice
that you also get a space.

Completion is now done relative to the cursor. You can enter two words
and then go back and complete the first one.
2019-12-11 12:10:52 +01:00
William McPherson
244e525c73 Shell: Refactor append/insert procedure
This patch just factors out the procedure of adding characters at the
cursor position. It makes tab completion code much nicer.
2019-12-11 12:10:52 +01:00
William McPherson
bb311b970f Shell: Improve readability of cache_path()
I prefer String::format over StringBuilder here.
Also simplified a weird continue statement.
2019-12-11 12:10:52 +01:00
Valtteri Koskivuori
c0696ad3aa LookupServer: Switch to a more privacy-respecting DNS provider 2019-12-11 12:01:16 +01:00
Andreas Kling
7f8e9a0f55 HackStudio: Use a table view in the "find in files" widget
Make the results of a "find in files" operation look a lot nicer by
presenting them in a table format, instead of in a single-column list.

Since we don't yet support rich text in table view cells, use the
marker glyphs in the system default fixed-width font to show where the
matched text begins and ends on the line we found it on. :^)
2019-12-10 22:07:52 +01:00
Andreas Kling
5d7c0b0123 Fonts: Add two little marker glyphs to CsillaThin7x10
ASCII values 0x1 and 0x2 of this font now contain little helper glyphs
for showing left and right side markers around something.
2019-12-10 22:06:52 +01:00
Andreas Kling
150090c742 LibGUI: Add GTextDocument::range_for_entire_line() 2019-12-10 22:06:31 +01:00
Andreas Kling
9641f74310 AK: Teach URL::complete_url() how to resolve URL's starting with "/" 2019-12-10 21:13:00 +01:00
Andreas Kling
40b7d814c3 LibCore: Make CHttpJob::response() return a CHttpResponse*
We know that the CNetworkResponse inside a CHttpJob is always going to
be a CHttpResponse, so we can return a casted pointer to be nice. :^)
2019-12-10 20:46:33 +01:00
Valtteri Koskivuori
2a21675b01 Ports: C-ray rendering engine 2019-12-10 16:24:47 +01:00
Valtteri Koskivuori
fe1df9e9fb LibC: Implement strtod() 2019-12-10 16:24:47 +01:00
Valtteri Koskivuori
b8ac14a873 LibM: Implement pow() 2019-12-10 16:24:47 +01:00
remyabel
d8daa08359 GTreeView: Prevent doubleclick with right mouse button (#868)
This follows user expectations and prevents interference with context menu
handling.
2019-12-10 10:24:14 +01:00
Andreas Kling
f8ec8cc255 LibGUI: Mark the first GWindow back bitmap volatile immediately
We were previously waiting until the first bitmap buffer flip happened
before marking the back buffer volatile.
2019-12-09 21:33:39 +01:00
Andreas Kling
571c4d3fb8 LibGUI: Allow finding the source of a GAction activation
When a GAction is activated by a menu, or by a toolbar button, you can
now use GAction::activator() to get a pointer to whomever activated it.

This can be used to implement context-specific behaviors in situations
where the same action is exposed through multiple paths.

This addresses an issue that was brought up in #826.
2019-12-09 21:29:43 +01:00
Andreas Kling
fd5eb79d19 LibGUI: Make GMenu inherit from CObject
This is primarily to make it possible to pass a GMenu* where a CObject*
is expected.
2019-12-09 21:05:44 +01:00
Andreas Kling
e9dda8d592 Kernel: Give PTY's *actually* unique major ID's
Okay, one "dunce hat" point for me. The new PTY majors conflicted with
PATAChannel. Now they are 200 for master and 201 for slave, not used
by anything else.. I hope!
2019-12-09 21:03:39 +01:00