dect
/
asterisk
Archived
13
0
Fork 0
Commit Graph

30 Commits

Author SHA1 Message Date
russell 22813ed533 Fix a regression in scheduler entry ordering, and add a regression test for it.
(closes issue #14522)
Reported by: pj
Tested by: russell


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@178022 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-23 17:29:16 +00:00
russell 488748dd1f Significantly improve scheduler performance under high load.
This patch changes the scheduler to use a max-heap to store pending scheduler
entries instead of a fully sorted doubly linked list.  When the number of
entries in the scheduler gets large, this will perform much better.  For much
more detailed information on this change, see the review request.

Review: http://reviewboard.digium.com/r/160/


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@176639 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-17 21:04:08 +00:00
russell a67e27326e Make ast_sched_report() and ast_sched_dump() thread safe.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@175882 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-15 21:27:33 +00:00
russell 3714d9820f Fix a number of problems with ast_sched_report().
1) It had numerous coding guidelines violations with regards to formatting.

2) It allocated memory using ast_calloc() that was never freed.

3) It didn't check for failure from the allocation.

4) It used sprintf() and strcat() to build the result, doing zero checking to
   prevent writing past the end of the provided buffer.

The function also lacks API documentation, but that has not been addressed in
this commit.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@175829 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-15 20:56:27 +00:00
russell 65e7ac9ff3 Add a common implementation of a scheduler context with a dedicated thread.
This commit expands the Asterisk scheduler API to include a common implementation
of a scheduler context being processed by a dedicated thread.  chan_iax2 has been
updated to use this new code.  Also, as a result, this resolves some race
conditions related to the previous chan_iax2 scheduler handling.

Related to rev 171452 which resolved the same issues in 1.4.

Code from team/russell/sched_thread2

Review: http://reviewboard.digium.com/r/129/


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@173858 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-06 10:55:35 +00:00
russell 9edab8434d Merged revisions 142354 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r142354 | russell | 2008-09-10 11:39:53 -0500 (Wed, 10 Sep 2008) | 7 lines

It is a normal situation that a task gets put in the scheduler that should run
as soon as possible.  Accept "0" as an acceptable time to run, and also treat
negative as "run now", and don't print a debug message about it.

(inspired by a message asking about the "request to schedule in the past"
 debug message on the -dev list)

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@142355 f38db490-d61c-443f-a65b-d21fe96a405b
2008-09-10 16:41:55 +00:00
seanbright 629f375c67 That's all, folks. Not going to update the Makefile until res_jabber is
converted (snuffy, you there? :))


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@137110 f38db490-d61c-443f-a65b-d21fe96a405b
2008-08-10 20:57:25 +00:00
tilghman f52ba8f25f Oops, wrong define
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@134703 f38db490-d61c-443f-a65b-d21fe96a405b
2008-07-30 22:38:58 +00:00
tilghman c38013c177 Merged revisions 131988 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r131988 | tilghman | 2008-07-18 12:10:01 -0500 (Fri, 18 Jul 2008) | 2 lines

Oops

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@131989 f38db490-d61c-443f-a65b-d21fe96a405b
2008-07-18 17:10:34 +00:00
tilghman 59a2caa7f0 Merged revisions 131985 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r131985 | tilghman | 2008-07-18 11:46:23 -0500 (Fri, 18 Jul 2008) | 2 lines

Preserve ABI compatibility with last change

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@131986 f38db490-d61c-443f-a65b-d21fe96a405b
2008-07-18 16:48:18 +00:00
tilghman da51d253b4 Merged revisions 131970 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r131970 | tilghman | 2008-07-18 11:30:31 -0500 (Fri, 18 Jul 2008) | 2 lines

Make the ast_assert call within ast_sched_del report something useful.

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@131982 f38db490-d61c-443f-a65b-d21fe96a405b
2008-07-18 16:33:56 +00:00
tilghman ba5ec156c0 Merged revisions 121861 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r121861 | tilghman | 2008-06-11 13:18:16 -0500 (Wed, 11 Jun 2008) | 3 lines

Make calls to ast_assert() actually test something, so that the error message
printed is not nonsensical (reported by mvanbaak via #asterisk-bugs).

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@121867 f38db490-d61c-443f-a65b-d21fe96a405b
2008-06-11 18:19:24 +00:00
rizzo b19d55996c Use casts or intermediate variables to remove a number
of platform/compiler-dependent warnings when handing
struct timeval fields, both reading and printing them.

It is a lost battle to handle the different ways struct timeval
is handled on the various platforms and compilers, so try
to be pragmatic and go through int/long which are universally
supported.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@116557 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-15 10:56:29 +00:00
russell cb7fdf2ae2 Merged revisions 116463 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r116463 | russell | 2008-05-14 16:32:00 -0500 (Wed, 14 May 2008) | 4 lines

Add ast_assert(), which can be used to handle fatal errors.  It is only compiled
in if dev-mode is enabled, and only aborts if DO_CRASH is defined.
(inspired by issue #12650)

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@116469 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-14 21:40:43 +00:00
russell 6a3cb06cc0 Fix up a problem that was introduced into the scheduler when it was converted
to use doubly linked lists.  The schedule() function had an optimization that
had it try to guess which direction would be better for the traversal to insert
the task into the scheduler queue.  However, if the code chose the path where
it traversed the queue in reverse, and the result was that the task should be
at the head of the queue, then the code would actually put it at the tail,
instead.

(Problem found by bbryant, debugged and fixed by bbryant and me)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@115537 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-07 21:11:33 +00:00
tilghman 748f3cf456 Add attributes to various API calls, to help track down bugs (and remove a deprecated function)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@115157 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-02 02:33:04 +00:00
murf 800b2ead72 Introducing a small upgrade to the ast_sched_xxx facility, to keep it from eating up lots of cpu cycles. See CHANGES. From the team/murf/bug11210 branch.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@114182 f38db490-d61c-443f-a65b-d21fe96a405b
2008-04-16 20:09:39 +00:00
rizzo de2db05332 remove a bunch of useless #include "options.h"
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89511 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-21 23:09:02 +00:00
rizzo 0cc47e4221 another bunch of include removals (errno.h and asterisk/logger.h)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89425 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-19 19:09:03 +00:00
rizzo 883346d64a Start untangling header inclusion in a way that does not affect
build times - tested, there is no measureable difference before and
after this commit.

In this change:

use asterisk/compat.h to include a small set of system headers:
inttypes.h, unistd.h, stddef.h, stddint.h, sys/types.h, stdarg.h,
stdlib.h, alloca.h, stdio.h

Where available, the inclusion is conditional on HAVE_FOO_H as determined
by autoconf.

Normally, source files should not include any of the above system headers,
and instead use either "asterisk.h" or "asterisk/compat.h" which does it
better. 

For the time being I have left alone second-level directories
(main/db1-ast, etc.).



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89333 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-16 20:04:58 +00:00
kpfleming a45a413db3 improve linked-list macros in two ways:
- the *_CURRENT macros no longer need the list head pointer argument
  - add AST_LIST_MOVE_CURRENT to encapsulate the remove/add operation when moving entries between lists


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89106 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-08 05:28:47 +00:00
russell 16927b7f7a Merged revisions 83432 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r83432 | russell | 2007-09-21 09:37:20 -0500 (Fri, 21 Sep 2007) | 4 lines

gcc 4.2 has a new set of warnings dealing with cosnt pointers.  This set of
changes gets all of Asterisk (minus chan_alsa for now) to compile with gcc 4.2.
(closes issue #10774, patch from qwell)

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@83433 f38db490-d61c-443f-a65b-d21fe96a405b
2007-09-21 14:40:10 +00:00
tilghman f925e7cf1b A schedule id of 0 is not possible and is used to flag that we want to add a new item
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@81390 f38db490-d61c-443f-a65b-d21fe96a405b
2007-08-30 20:31:45 +00:00
russell d023eb5b70 This commit adds a scheduler API call, ast_sched_replace that can be used
in place of a very common construct.  I also used it in a number of places
in chan_sip.

  if (id > -1)
     ast_sched_del(sched, id);
  id = ast_sched_add(sched, ...);

changes to:

  ast_sched_replace(id, sched, ...);


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@79861 f38db490-d61c-443f-a65b-d21fe96a405b
2007-08-17 14:07:44 +00:00
russell 6116c57c53 Convert so more logging to ast_debug (issue #10045, dimas)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@71557 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-25 13:42:51 +00:00
russell 438cb82e0f Conversions to ast_debug()
(issue #9984, patches from eliel and dimas)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@71338 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-24 18:51:41 +00:00
tilghman eb5d461ed4 Issue 9869 - replace malloc and memset with ast_calloc, and other coding guidelines changes
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@67864 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-06 21:20:11 +00:00
file 1bfbea18eb Merged revisions 56457 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r56457 | file | 2007-02-23 16:53:41 -0500 (Fri, 23 Feb 2007) | 2 lines

Change log notice to debug. It is possible for a scheduled item to execute and be deleted at close to the same time and unavoidable. If this happens this message creeps up.

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@56458 f38db490-d61c-443f-a65b-d21fe96a405b
2007-02-23 21:57:07 +00:00
mogorman 4a1aaf52ae bug #8076 check option_debug before printing to debug channel.
patch provided in bugnote, with minor changes.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44253 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-03 15:53:07 +00:00
kpfleming 8b0c007ad9 merge new_loader_completion branch, including (at least):
- restructured build tree and makefiles to eliminate recursion problems
  - support for embedded modules
  - support for static builds
  - simpler cross-compilation support
  - simpler module/loader interface (no exported symbols)



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40722 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-21 02:11:39 +00:00