Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
further API doc improvement
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 11 Nov 2019 00:17:00 +0000 (01:17 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 11 Nov 2019 00:17:00 +0000 (01:17 +0100)
docs/find-missing.py
docs/source/app_s4u.rst
include/simgrid/kernel/resource/Action.hpp
include/simgrid/s4u/Activity.hpp
include/simgrid/s4u/Actor.hpp
include/simgrid/s4u/Barrier.hpp
include/simgrid/s4u/ConditionVariable.hpp

index 02a18d1..4e1afee 100755 (executable)
@@ -22,7 +22,7 @@ import xml.etree.ElementTree as ET
 import inspect
 
 xml_files = [
-#    'build/xml/classsimgrid_1_1s4u_1_1Activity.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1Activity.xml',
     'build/xml/classsimgrid_1_1s4u_1_1Actor.xml',
     'build/xml/classsimgrid_1_1s4u_1_1Barrier.xml',
     'build/xml/classsimgrid_1_1s4u_1_1Comm.xml',
@@ -113,7 +113,7 @@ for kind in python_decl:
 # Dump the missing ones
 for kind in python_decl:
     for fullname in python_decl[kind]:
-        print("Missing decl: .. auto{}:: {}".format(kind, fullname))
+        print(" .. auto{}:: {}".format(kind, fullname))
 
 ################ And now deal with Doxygen declarations
 ################
@@ -122,7 +122,7 @@ doxy_funs = {} # {classname: {func_name: [args]} }
 doxy_vars = {} # {classname: [names]}
 
 # find the declarations in the XML files
-for arg in xml_files[:1]:
+for arg in xml_files[:3]:
     if arg[-4:] != '.xml':
         print ("Argument '{}' does not end with '.xml'".format(arg))
         continue
@@ -192,12 +192,12 @@ with os.popen('grep autodoxyvar:: source/*rst|sed \'s/^.*autodoxyvar:: //\'') as
                 del doxy_vars[klass]
 
 # Dump the undocumented Doxygen declarations 
-for obj in doxy_funs:
-    for meth in doxy_funs[obj]:
-        for args in doxy_funs[obj][meth]:
-            print("Missing decl: .. autodoxymethod:: {}::{}{}".format(obj, meth, args))
+for obj in sorted(doxy_funs):
+    for meth in sorted(doxy_funs[obj]):
+        for args in sorted(doxy_funs[obj][meth]):
+            print(".. autodoxymethod:: {}::{}{}".format(obj, meth, args))
 
 for obj in doxy_vars:
-    for meth in doxy_vars[obj]:
-        print("Missing decl: .. autodoxyvar:: {}::{}".format(obj, meth))
+    for meth in sorted(doxy_vars[obj]):
+        print(".. autodoxyvar:: {}::{}".format(obj, meth))
 
index 4ad60bd..46f3d92 100644 (file)
@@ -66,58 +66,58 @@ provides many helper functions to simplify the code of actors.
 
 - **Global Classes**
 
-  - :ref:`class s4u::Actor <API_s4u_Actor>`:
+  - :ref:`class Actor <API_s4u_Actor>`:
     Active entities executing your application.
-  - :ref:`class s4u::Engine <API_s4u_Engine>`
+  - :ref:`class Engine <API_s4u_Engine>`
     Simulation engine (singleton).
-  - :ref:`class s4u::Mailbox <API_s4u_Mailbox>`
+  - :ref:`class Mailbox <API_s4u_Mailbox>`
     Communication rendez-vous.
 
 - **Platform Elements**
 
-  - :ref:`class s4u::Disk <API_s4u_Disk>`
+  - :ref:`class Disk <API_s4u_Disk>`
     Resource on which actors can write and read data.
-  - :ref:`class s4u::Host <API_s4u_Host>`:
+  - :ref:`class Host <API_s4u_Host>`:
     Actor location, providing computational power.
-  - :ref:`class s4u::Link <API_s4u_Link>`
+  - :ref:`class Link <API_s4u_Link>`
     Interconnecting hosts.
-  - :ref:`class s4u::NetZone <API_s4u_NetZone>`:
+  - :ref:`class NetZone <API_s4u_NetZone>`:
     Sub-region of the platform, containing resources (Hosts, Links, etc).
-  - :ref:`class s4u::VirtualMachine <API_s4u_VirtualMachine>`:
+  - :ref:`class VirtualMachine <API_s4u_VirtualMachine>`:
     Execution containers that can be moved between Hosts.
 
-- **Activities** (:ref:`class s4u::Activity <API_s4u_Activity>`):
+- **Activities** (:ref:`class Activity <API_s4u_Activity>`):
   The things that actors can do on resources
 
-  - :ref:`class s4u::Comm <API_s4u_Comm>`
+  - :ref:`class Comm <API_s4u_Comm>`
     Communication activity, started on Mailboxes and consuming links.
-  - :ref:`class s4u::Exec <API_s4u_Exec>`
+  - :ref:`class Exec <API_s4u_Exec>`
     Computation activity, started on Host and consuming CPU resources.
-  - :ref:`class s4u::Io <API_s4u_Io>`
+  - :ref:`class Io <API_s4u_Io>`
     I/O activity, started on and consumming disks.
 
 - **Synchronization Mechanisms**: Classical IPC that actors can use
 
-  - :ref:`class s4u::Barrier <API_s4u_Barrier>`
-  - :ref:`class s4u::ConditionVariable <API_s4u_ConditionVariable>`
-  - :ref:`class s4u::Mutex <API_s4u_Mutex>`
-  - :ref:`class s4u::Semaphore <API_s4u_Semaphore>`
+  - :ref:`class Barrier <API_s4u_Barrier>`
+  - :ref:`class ConditionVariable <API_s4u_ConditionVariable>`
+  - :ref:`class Mutex <API_s4u_Mutex>`
+  - :ref:`class Semaphore <API_s4u_Semaphore>`
 
 
 .. |API_s4u_Actors| replace:: **Actors**
-.. _API_s4u_Actors: #s4u-actor
+.. _API_s4u_Actors: #api-s4u-actor
 
 .. |API_s4u_Activities| replace:: **Activities**
-.. _API_s4u_Activities: #s4u-activity
+.. _API_s4u_Activities: #api-s4u-activity
 
 .. |API_s4u_Hosts| replace:: **Hosts**
-.. _API_s4u_Hosts: #s4u-host
+.. _API_s4u_Hosts: #api-s4u-host
 
 .. |API_s4u_Links| replace:: **Links**
-.. _API_s4u_Links: #s4u-link
+.. _API_s4u_Links: #api-s4u-link
 
 .. |API_s4u_Disks| replace:: **Disks**
-.. _API_s4u_Disks: #s4u-disk
+.. _API_s4u_Disks: #api-s4u-disk
 
 .. |API_s4u_VirtualMachine| replace:: **VirtualMachines**
 
@@ -138,12 +138,16 @@ provides many helper functions to simplify the code of actors.
 
 .. |API_s4u_Mutex| replace:: **Mutex**
 
+.. _s4u_Activities:
+
 Activities
 **********
 
 Activities represent the actions that consume a resource, such as a
-:ref:`s4u::Comm <API_s4u_Comm>` that consumes the *transmitting power* of
-:ref:`s4u::Link <API_s4u_Link>` resources.
+:ref:`Comm <API_s4u_Comm>` that consumes the *transmitting power* of 
+:ref:`Link <API_s4u_Link>` resources, or an :ref:`Exec <API_s4u_Exec>`
+that consumes the *computing power* of :ref:`Host <API_s4u_Host>` resources.
+See also the :ref:`full API <API_s4u_Activity>` below.
 
 =======================
 Asynchronous Activities
@@ -384,14 +388,36 @@ Static methods working on the current actor (see :ref:`API_s4u_Actor`).
 
 .. _API_s4u_Activity:
 
-=============
-s4u::Activity
-=============
+==============
+class Activity
+==============
+
+.. autodoxyclass:: simgrid::s4u::Activity
+
+   **Known subclasses:**
+   :ref:`Communications <API_s4u_Comm>` (started on Mailboxes and consuming links),
+   :ref:`Executions <API_s4u_Exec>` (started on Host and consuming CPU resources)
+   :ref:`I/O <API_s4u_Io>` (started on and consumming disks).
+   See also the :ref:`section on activities <s4u_Activities>` above.
+
+Querying info about activities
+------------------------------
+
+   .. autodoxymethod:: simgrid::s4u::Activity::get_remaining()
+   .. autodoxymethod:: simgrid::s4u::Activity::get_state()
+   .. autodoxymethod:: simgrid::s4u::Activity::set_remaining(double remains)
+   .. autodoxymethod:: simgrid::s4u::Activity::get_impl
+
+Activities lifecycle
+--------------------
+
+   .. autodoxymethod:: simgrid::s4u::Activity::cancel
+   .. autodoxymethod:: simgrid::s4u::Activity::start
+   .. autodoxymethod:: simgrid::s4u::Activity::test
+   .. autodoxymethod:: simgrid::s4u::Activity::wait
+   .. autodoxymethod:: simgrid::s4u::Activity::wait_for
+   .. autodoxymethod:: simgrid::s4u::Activity::wait_until(double time_limit)
 
-.. doxygenclass:: simgrid::s4u::Activity
-   :members:
-   :protected-members:
-   :undoc-members:
 
 .. _API_s4u_Actor:
 
@@ -545,16 +571,22 @@ Signals
 
 .. _API_s4u_Barrier:
 
-============
-s4u::Barrier
-============
+=============
+class Barrier
+=============
 
 .. doxygentypedef:: BarrierPtr
 
-.. doxygenclass:: simgrid::s4u::Barrier
-   :members:
-   :protected-members:
-   :undoc-members:
+.. autodoxyclass:: simgrid::s4u::Barrier
+
+   .. tabs::
+
+      .. group-tab:: C++
+
+         .. autodoxymethod:: simgrid::s4u::Barrier::Barrier(unsigned int count)
+         .. autodoxymethod:: simgrid::s4u::Barrier::create(unsigned int expected_actors)
+         .. autodoxymethod:: simgrid::s4u::Barrier::wait()
+
 
 .. _API_s4u_Comm:
 
index 2821e7f..00ae0df 100644 (file)
@@ -47,7 +47,14 @@ public:
 /** @details An action is a consumption on a resource (e.g.: a communication for the network).
  *
  * It is related (but still different) from activities, that are the stuff on which an actor can be blocked.
- * See simgrid::s4u::Activity for more details.
+ *
+ * - A sequential execution activity encompasses 2 actions: one for the exec itself,
+ *   and a time-limited sleep used as timeout detector.
+ * - A point-to-point communication activity encompasses 3 actions: one for the comm itself
+ *   (which spans on all links of the path), and one infinite sleep used as failure detector
+ *   on both sender and receiver hosts.
+ * - Synchronization activities may possibly be connected to no action.
+
  */
 class XBT_PUBLIC Action {
   friend ActionHeap;
index b846b3c..c7bc18d 100644 (file)
@@ -19,16 +19,6 @@ namespace s4u {
  *
  * This class is the ancestor of every activities that an actor can undertake.
  * That is, activities are all the things that do take time to the actor in the simulated world.
- *
- * They are somewhat linked but not identical to simgrid::kernel::resource::Action,
- * that are stuff occurring on a resource:
- *
- * - A sequential execution activity encompasses 2 actions: one for the exec itself,
- *   and a time-limited sleep used as timeout detector.
- * - A point-to-point communication activity encompasses 3 actions: one for the comm itself
- *   (which spans on all links of the path), and one infinite sleep used as failure detector
- *   on both sender and receiver hosts.
- * - Synchronization activities may possibly be connected to no action.
  */
 class XBT_PUBLIC Activity {
   friend Comm;
@@ -86,8 +76,7 @@ public:
    * It is forbidden to change the amount of work once the Activity is started */
   Activity* set_remaining(double remains);
 
-  /** Put some user data onto the Activity */
-
+  /** Returns the internal implementation of this Activity */
   kernel::activity::ActivityImpl* get_impl() const { return pimpl_.get(); }
 
 private:
index 210d252..d0b6d4c 100644 (file)
@@ -28,7 +28,7 @@ namespace s4u {
  * You can think of an actor as a process in your distributed application, or as a thread in a multithreaded program.
  * This is the only component in SimGrid that actually does something on its own, executing its own code.
  * A resource will not get used if you don't schedule activities on them. This is the code of Actors that create and
- * schedule these activities. Please refer to the :ref:`examples <s4u_ex_actors>` for more information.
+ * schedule these activities. **Please refer to the** :ref:`examples <s4u_ex_actors>` **for more information.**
  *
  * This API is strongly inspired from the C++11 threads.
  * The `documentation of this standard <http://en.cppreference.com/w/cpp/thread>`_
index 6a2dcb7..db8e05e 100644 (file)
@@ -29,14 +29,17 @@ private:
   std::atomic_int_fast32_t refcount_{0};
 
 public:
+  /** Creates a barrier for the given amount of actors */
   explicit Barrier(unsigned int count);
-  ~Barrier()              = default;
 #ifndef DOXYGEN
+  ~Barrier()              = default;
   Barrier(Barrier const&) = delete;
   Barrier& operator=(Barrier const&) = delete;
 #endif
 
+  /** Creates a barrier for the given amount of actors */
   static BarrierPtr create(unsigned int expected_actors);
+  /** Blocks into the barrier. Every waiting actors will be unlocked once the expected amount of actors reaches the barrier */
   int wait();
 
 #ifndef DOXYGEN
index f11df5c..946a2d5 100644 (file)
@@ -30,11 +30,14 @@ private:
 
 public:
   explicit ConditionVariable(kernel::activity::ConditionVariableImpl* cond) : cond_(cond) {}
+
+#ifndef DOXYGEN
   ConditionVariable(ConditionVariable const&) = delete;
   ConditionVariable& operator=(ConditionVariable const&) = delete;
 
   friend XBT_PUBLIC void intrusive_ptr_add_ref(ConditionVariable * cond);
   friend XBT_PUBLIC void intrusive_ptr_release(ConditionVariable * cond);
+#endif
 
   static ConditionVariablePtr create();