diff options
author | Erlang/OTP <[email protected]> | 2010-02-17 11:13:42 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2010-02-17 11:13:42 +0000 |
commit | 40b76c2e854c9771f8699fd143299ad2d6de4603 (patch) | |
tree | 0785b7428656150c1ee6d19345dee941355ab4f6 /lib/percept/src/percept_db.erl | |
parent | 4a33e37e8c1b4f60a6890dccae438cd8fbbb05ef (diff) | |
parent | a8bf1fe3b9f5f69354403231a3c47489d9015977 (diff) | |
download | otp-40b76c2e854c9771f8699fd143299ad2d6de4603.tar.gz otp-40b76c2e854c9771f8699fd143299ad2d6de4603.tar.bz2 otp-40b76c2e854c9771f8699fd143299ad2d6de4603.zip |
Merge branch 'ks/cleanups' into ccase/r13b04_dev
* ks/cleanups:
percept: Clean up as suggested by tidier
percept: Modernize types and specs
parsetools: Don't use 'try...of' when 'try' will do
parsetools: Use %% for comments at the beginning of a line
parsetools: Replace lists:keysearch/3 with lists:keyfind/3
parsetools: Modernize types and specs
parsetools: Replace TABs with spaces
runtime_tools: Modernize specs
sasl: Eliminate tuple used as fun
sasl: Add missing modules to app file
asn1: Clean up as suggested by tidier
os_mon: Modernize types and specs
wx: Clean up as suggested by tidier
OTP-8455 ks/cleanups
Diffstat (limited to 'lib/percept/src/percept_db.erl')
-rw-r--r-- | lib/percept/src/percept_db.erl | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/lib/percept/src/percept_db.erl b/lib/percept/src/percept_db.erl index dc85fa3510..edb0d79a29 100644 --- a/lib/percept/src/percept_db.erl +++ b/lib/percept/src/percept_db.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% @@ -72,7 +72,7 @@ %% Pid = pid() %% @doc Starts or restarts the percept database. --spec(start/0 :: () -> {'started', pid()} | {'restarted', pid()}). +-spec start() -> {'started', pid()} | {'restarted', pid()}. start() -> case erlang:whereis(percept_db) of @@ -92,7 +92,7 @@ start() -> %% Pid = pid() %% @doc Stops the percept database. --spec(stop/0 :: () -> 'not_started' | {'stopped', pid()}). +-spec stop() -> 'not_started' | {'stopped', pid()}. stop() -> case erlang:whereis(percept_db) of @@ -392,23 +392,14 @@ consolidate_runnability_loop(Key) -> consolidate_runnability_loop(ets:next(pdb_activity, Key)). list_all_ts() -> - ATs = [ Act#activity.timestamp || - Act <- select_query({activity, []})], - STs = [ Act#activity.timestamp || - Act <- select_query({scheduler, []})], + ATs = [Act#activity.timestamp || Act <- select_query({activity, []})], + STs = [Act#activity.timestamp || Act <- select_query({scheduler, []})], ITs = lists:flatten([ [I#information.start, I#information.stop] || I <- select_query({information, all})]), - % Filter out all undefined (non ts) - TsList = lists:filter( - fun(Element) -> - case Element of - {_,_,_} -> true; - _ -> false - end - end, ATs ++ STs ++ ITs), - TsList. + %% Filter out all undefined (non ts) + [Elem || Elem = {_,_,_} <- ATs ++ STs ++ ITs]. %% get_runnable_count(Type, State) -> RunnableCount %% In: |